Mercurial > libervia-backend
diff src/core/constants.py @ 994:652c01ca69b1
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
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 19 Apr 2014 20:11:23 +0200 |
parents | 05e02f8b7eb4 |
children | eb3601ff73bc |
line wrap: on
line diff
--- a/src/core/constants.py Sat Apr 19 19:19:19 2014 +0200 +++ b/src/core/constants.py Sat Apr 19 20:11:23 2014 +0200 @@ -34,6 +34,7 @@ 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 @@ 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 @@ 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