core (log): configuration and environment variables are now checked for log level and colors:
- variable change logs behaviour, so far only level and colors are implemented
- configuration use log_[name], for example you can put log_level=debug in sat.conf (section [DEFAULT]) to see all levels
- environment variables use SAT_LOG_[NAME]: e.g. SAT_LOG_LEVEL=debug
- colors can be true, false or force to force colors even if stdout is not a tty
This commit is contained in:
parent
501bc92528
commit
317342b616
1 changed files with 60 additions and 5 deletions
|
|
@ -34,6 +34,7 @@ class Const(object):
|
|||
APP_VERSION = u'0.4.1D' # Please add 'D' at the end for dev versions
|
||||
APP_URL = 'http://salut-a-toi.org'
|
||||
|
||||
|
||||
## Parameters ##
|
||||
NO_SECURITY_LIMIT = -1
|
||||
INDIVIDUAL = "individual"
|
||||
|
|
@ -47,6 +48,8 @@ class Const(object):
|
|||
ENTITY_LAST_RESOURCE = 'LAST_RESOURCE'
|
||||
ENTITY_CAP_HASH = 'CAP_HASH'
|
||||
|
||||
|
||||
## Configuration ##
|
||||
if BaseDirectory: # skipped when imported from Libervia browser_side
|
||||
|
||||
## Configuration ##
|
||||
|
|
@ -66,21 +69,30 @@ class Const(object):
|
|||
CONFIG_FILES = [(os.path.expanduser(path) + 'sat.conf') for path in \
|
||||
['/etc/', '~/', '~/.', '', '.'] + \
|
||||
['%s/' % path for path in list(BaseDirectory.load_config_paths('sat'))]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
## Plugins ##
|
||||
# names of widely used plugins
|
||||
TEXT_CMDS = 'TEXT-COMMANDS'
|
||||
|
||||
|
||||
## Logging ##
|
||||
LOG_BACKEND_STANDARD = 'standard'
|
||||
LOG_BACKEND_TWISTED = 'twisted'
|
||||
LOG_BACKEND_BASIC = 'basic'
|
||||
LOG_BASE_LOGGER = 'root'
|
||||
LOG_OPT_PREFIX = 'log_'
|
||||
# (option_name, default_value) tuples
|
||||
LOG_OPT_COLORS = ('colors', 'true')
|
||||
LOG_OPT_LEVEL = ('level', 'info')
|
||||
|
||||
|
||||
## Misc ##
|
||||
SAVEFILE_DATABASE = "sat.db"
|
||||
IQ_SET = '/iq[@type="set"]'
|
||||
ENV_PREFIX = 'SAT_' # Prefix used for environment variables
|
||||
|
||||
|
||||
## ANSI escape sequences ##
|
||||
# XXX: used for logging
|
||||
|
|
|
|||
Loading…
Reference in a new issue