Improve logging on server
Log to file and std. Configured in server config file.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# This config will be copied on first launch.
|
||||
# Edit the the copied file at '~/.config/dsst/server.json' before launching the server
|
||||
# IMPORTANT: For a client to access the server you have to set authentication tokens in the server config
|
||||
DEFAULT_CONFIG = {
|
||||
'database': {
|
||||
'db_name': 'dsst',
|
||||
@@ -7,12 +8,38 @@ DEFAULT_CONFIG = {
|
||||
'password': 'dsst'
|
||||
},
|
||||
'server': {
|
||||
'host': 'localhost',
|
||||
'port': 55225,
|
||||
'buffer_size': 1024
|
||||
},
|
||||
'tokens': {
|
||||
'<read_write_token_here>': 'rw',
|
||||
'<read_only_token_here>': 'r'
|
||||
}
|
||||
'readonly': [],
|
||||
'readwrite': []
|
||||
},
|
||||
'logging': dict(
|
||||
version=1,
|
||||
disable_existing_loggers=False,
|
||||
formatters={
|
||||
'file': {'format': '[%(levelname)s] %(asctime)s - %(message)s',
|
||||
'datefmt': '%Y-%m-%d %H:%M:%S'},
|
||||
'std': {'format': '[%(levelname)s] %(message)s'}
|
||||
},
|
||||
handlers={
|
||||
'console': {
|
||||
'class': 'logging.StreamHandler',
|
||||
'formatter': 'std',
|
||||
'level': 'INFO'
|
||||
},
|
||||
'logfile': {
|
||||
'class': 'logging.handlers.RotatingFileHandler',
|
||||
'maxBytes': 3145728,
|
||||
'backupCount': 1,
|
||||
'formatter': 'file',
|
||||
'level': 'INFO'
|
||||
}
|
||||
|
||||
},
|
||||
root={
|
||||
'handlers': ['console', 'logfile'],
|
||||
'level': 'INFO'
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user