diff 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
line wrap: on
line diff
--- a/src/core/constants.py	Mon May 05 18:58:34 2014 +0200
+++ b/src/core/constants.py	Mon May 05 20:12:19 2014 +0200
@@ -79,6 +79,7 @@
     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 @@
     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 @@
     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)
+