primitivus: use of new logging system:
- default output is \\memory
- logs can be seen with :messages command
- now useless writeLog method has been removed
This commit is contained in:
parent
468206e529
commit
39989cc985
1 changed files with 80 additions and 43 deletions
|
|
@ -79,6 +79,7 @@ class Const(object):
|
|||
LOG_BACKEND_BASIC = 'basic'
|
||||
LOG_BASE_LOGGER = 'root'
|
||||
LOG_TWISTED_LOGGER = 'twisted'
|
||||
LOG_OPT_SECTION = 'DEFAULT' # section of sat.conf where log options should be
|
||||
LOG_OPT_PREFIX = 'log_'
|
||||
# (option_name, default_value) tuples
|
||||
LOG_OPT_COLORS = ('colors', 'true') # true for auto colors, force to have colors even if stdout is not a tty, false for no color
|
||||
|
|
@ -91,7 +92,6 @@ class Const(object):
|
|||
LOG_OPT_OUTPUT_MEMORY_LIMIT = 50
|
||||
LOG_OPT_OUTPUT_FILE = 'file' # file is implicit if only output
|
||||
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)
|
||||
LOG_OPTIONS = (LOG_OPT_COLORS, LOG_OPT_LEVEL, LOG_OPT_FORMAT, LOG_OPT_LOGGER, LOG_OPT_OUTPUT)
|
||||
LOG_LVL_DEBUG = 'DEBUG'
|
||||
LOG_LVL_INFO = 'INFO'
|
||||
LOG_LVL_WARNING = 'WARNING'
|
||||
|
|
@ -115,3 +115,10 @@ class Const(object):
|
|||
ANSI_BOLD = '\033[1m'
|
||||
ANSI_BLINK = '\033[5m'
|
||||
ANSI_BLINK_OFF = '\033[25m'
|
||||
|
||||
@classmethod
|
||||
def LOG_OPTIONS(cls):
|
||||
"""Return options checked for logs"""
|
||||
# XXX: we use a classmethod so we can use Const inheritance to change default options
|
||||
return(cls.LOG_OPT_COLORS, cls.LOG_OPT_LEVEL, cls.LOG_OPT_FORMAT, cls.LOG_OPT_LOGGER, cls.LOG_OPT_OUTPUT)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue