Mercurial > libervia-backend
comparison src/core/constants.py @ 1010:73a0b7f94674
primitivus: use of new logging system:
- default output is \\memory
- logs can be seen with :messages command
- now useless writeLog method has been removed
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 05 May 2014 20:12:19 +0200 |
parents | a7d33c7a8277 |
children | 0ea97f483464 |
comparison
equal
deleted
inserted
replaced
1009:d1084f7e56a5 | 1010:73a0b7f94674 |
---|---|
77 LOG_BACKEND_STANDARD = 'standard' | 77 LOG_BACKEND_STANDARD = 'standard' |
78 LOG_BACKEND_TWISTED = 'twisted' | 78 LOG_BACKEND_TWISTED = 'twisted' |
79 LOG_BACKEND_BASIC = 'basic' | 79 LOG_BACKEND_BASIC = 'basic' |
80 LOG_BASE_LOGGER = 'root' | 80 LOG_BASE_LOGGER = 'root' |
81 LOG_TWISTED_LOGGER = 'twisted' | 81 LOG_TWISTED_LOGGER = 'twisted' |
82 LOG_OPT_SECTION = 'DEFAULT' # section of sat.conf where log options should be | |
82 LOG_OPT_PREFIX = 'log_' | 83 LOG_OPT_PREFIX = 'log_' |
83 # (option_name, default_value) tuples | 84 # (option_name, default_value) tuples |
84 LOG_OPT_COLORS = ('colors', 'true') # true for auto colors, force to have colors even if stdout is not a tty, false for no color | 85 LOG_OPT_COLORS = ('colors', 'true') # true for auto colors, force to have colors even if stdout is not a tty, false for no color |
85 LOG_OPT_LEVEL = ('level', 'info') | 86 LOG_OPT_LEVEL = ('level', 'info') |
86 LOG_OPT_FORMAT = ('fmt', '%(message)s') # similar to logging format. | 87 LOG_OPT_FORMAT = ('fmt', '%(message)s') # similar to logging format. |
89 LOG_OPT_OUTPUT_DEFAULT = 'default' | 90 LOG_OPT_OUTPUT_DEFAULT = 'default' |
90 LOG_OPT_OUTPUT_MEMORY = 'memory' | 91 LOG_OPT_OUTPUT_MEMORY = 'memory' |
91 LOG_OPT_OUTPUT_MEMORY_LIMIT = 50 | 92 LOG_OPT_OUTPUT_MEMORY_LIMIT = 50 |
92 LOG_OPT_OUTPUT_FILE = 'file' # file is implicit if only output | 93 LOG_OPT_OUTPUT_FILE = 'file' # file is implicit if only output |
93 LOG_OPT_OUTPUT = ('output', LOG_OPT_OUTPUT_SEP + LOG_OPT_OUTPUT_DEFAULT) # //default = normal output (stderr or a file with twistd), path/to/file for a file (must be the first if used), //memory for memory (options can be put in parenthesis, e.g.: //memory(500) for a 500 lines memory) | 94 LOG_OPT_OUTPUT = ('output', LOG_OPT_OUTPUT_SEP + LOG_OPT_OUTPUT_DEFAULT) # //default = normal output (stderr or a file with twistd), path/to/file for a file (must be the first if used), //memory for memory (options can be put in parenthesis, e.g.: //memory(500) for a 500 lines memory) |
94 LOG_OPTIONS = (LOG_OPT_COLORS, LOG_OPT_LEVEL, LOG_OPT_FORMAT, LOG_OPT_LOGGER, LOG_OPT_OUTPUT) | |
95 LOG_LVL_DEBUG = 'DEBUG' | 95 LOG_LVL_DEBUG = 'DEBUG' |
96 LOG_LVL_INFO = 'INFO' | 96 LOG_LVL_INFO = 'INFO' |
97 LOG_LVL_WARNING = 'WARNING' | 97 LOG_LVL_WARNING = 'WARNING' |
98 LOG_LVL_ERROR = 'ERROR' | 98 LOG_LVL_ERROR = 'ERROR' |
99 LOG_LVL_CRITICAL = 'CRITICAL' | 99 LOG_LVL_CRITICAL = 'CRITICAL' |
113 ANSI_NORMAL_WEIGHT = '\033[22m' | 113 ANSI_NORMAL_WEIGHT = '\033[22m' |
114 ANSI_FG_BLACK, ANSI_FG_RED, ANSI_FG_GREEN, ANSI_FG_YELLOW, ANSI_FG_BLUE, ANSI_FG_MAGENTA, ANSI_FG_CYAN, ANSI_FG_WHITE = ('\033[3%dm' % nb for nb in xrange(8)) | 114 ANSI_FG_BLACK, ANSI_FG_RED, ANSI_FG_GREEN, ANSI_FG_YELLOW, ANSI_FG_BLUE, ANSI_FG_MAGENTA, ANSI_FG_CYAN, ANSI_FG_WHITE = ('\033[3%dm' % nb for nb in xrange(8)) |
115 ANSI_BOLD = '\033[1m' | 115 ANSI_BOLD = '\033[1m' |
116 ANSI_BLINK = '\033[5m' | 116 ANSI_BLINK = '\033[5m' |
117 ANSI_BLINK_OFF = '\033[25m' | 117 ANSI_BLINK_OFF = '\033[25m' |
118 | |
119 @classmethod | |
120 def LOG_OPTIONS(cls): | |
121 """Return options checked for logs""" | |
122 # XXX: we use a classmethod so we can use Const inheritance to change default options | |
123 return(cls.LOG_OPT_COLORS, cls.LOG_OPT_LEVEL, cls.LOG_OPT_FORMAT, cls.LOG_OPT_LOGGER, cls.LOG_OPT_OUTPUT) | |
124 |