Mercurial > libervia-backend
comparison src/core/log.py @ 1129:08f50fdac21b
core (logging): new backend_data parameter can be used to transmit specific data to a backend + Twisted backend use this option to know if we are in debug or nodaemon mode
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 25 Aug 2014 17:21:03 +0200 |
parents | a836b6da2c5c |
children | 069ad98b360d |
comparison
equal
deleted
inserted
replaced
1128:c7fe4fe66fbc | 1129:08f50fdac21b |
---|---|
153 | 153 |
154 | 154 |
155 class ConfigureBase(object): | 155 class ConfigureBase(object): |
156 LOGGER_CLASS = Logger | 156 LOGGER_CLASS = Logger |
157 | 157 |
158 def __init__(self, level=None, fmt=None, output=None, logger=None, colors=False, force_colors=False): | 158 def __init__(self, level=None, fmt=None, output=None, logger=None, colors=False, force_colors=False, backend_data=None): |
159 """Configure a backend | 159 """Configure a backend |
160 | 160 |
161 @param level: one of C.LOG_LEVELS | 161 @param level: one of C.LOG_LEVELS |
162 @param fmt: format string, pretty much as in std logging. Accept the following keywords (maybe more depending on backend): | 162 @param fmt: format string, pretty much as in std logging. Accept the following keywords (maybe more depending on backend): |
163 - "message" | 163 - "message" |
166 @param logger: if set, use it as a regular expression to filter on logger name. | 166 @param logger: if set, use it as a regular expression to filter on logger name. |
167 Use search to match expression, so ^ or $ can be necessary. | 167 Use search to match expression, so ^ or $ can be necessary. |
168 @param colors: if True use ANSI colors to show log levels | 168 @param colors: if True use ANSI colors to show log levels |
169 @param force_colors: if True ANSI colors are used even if stdout is not a tty | 169 @param force_colors: if True ANSI colors are used even if stdout is not a tty |
170 """ | 170 """ |
171 self.backend_data = backend_data | |
171 self.preTreatment() | 172 self.preTreatment() |
172 self.configureLevel(level) | 173 self.configureLevel(level) |
173 self.configureFormat(fmt) | 174 self.configureFormat(fmt) |
174 self.configureOutput(output) | 175 self.configureOutput(output) |
175 self.configureLogger(logger) | 176 self.configureLogger(logger) |