forked from nullpointer08/nullpointer-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart_client.py
91 lines (82 loc) · 2.42 KB
/
start_client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import logging.config
import os
from optparse import OptionParser
import subprocess
import ConfigParser
from client.client import Client
START_PATH = os.path.dirname(os.path.realpath(__file__))
START_SHELL_SCRIPT_NAME = 'start.sh'
CONFIG_PATH = os.path.join(START_PATH, 'client/client.properties')
'''
A command line utility for starting the client.
Use the -f or --fullscreen switch to start in fullscreen borderless mode
using xinit (X cannot be on)
'''
# LOGGING SETTINGS
LOGGING_CONFIG = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'simple': {
'format': '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
}
},
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'simple',
'level': 'ERROR',
},
'client_debug': {
'class': 'logging.handlers.RotatingFileHandler',
'level': 'DEBUG',
'formatter': 'simple',
'filename': os.path.join(START_PATH, 'client_debug.log'),
'maxBytes': 1024*1024, # 1MB
'backupCount': 2,
'encoding': 'utf8'
},
'display_debug': {
'class': 'logging.handlers.RotatingFileHandler',
'level': 'DEBUG',
'formatter': 'simple',
'filename': os.path.join(START_PATH, 'display_debug.log'),
'maxBytes': 1024*1024, # 1MB
'backupCount': 2,
'encoding': 'utf8'
},
'errors': {
'class': 'logging.handlers.RotatingFileHandler',
'level': 'ERROR',
'formatter': 'simple',
'filename': os.path.join(START_PATH, 'error.log'),
'maxBytes': 1024*1024*10, # 10MB
'backupCount': 2,
'encoding': 'utf8'
},
},
'loggers': {
'': {
'handlers': ['console', 'errors'],
'level': 'ERROR',
},
'client': {
'handlers': ['client_debug'],
'level': 'DEBUG',
},
'display': {
'handlers': ['display_debug'],
'level': 'DEBUG',
},
},
}
def run():
config = ConfigParser.ConfigParser()
with open(CONFIG_PATH) as config_fp:
config.readfp(config_fp)
logging.config.dictConfig(LOGGING_CONFIG)
client = Client(config)
client.start()
if __name__ == '__main__':
print 'Starting main'
run()