Commit graph libervia-backend/src/core/log.py
Author SHA1 Message Date
Goffi
d549533f00 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 2014-08-25 17:21:03 +02:00
Goffi
ed2abd3971 core (log): moved configuration to core.log_config; this avoid import issues with pyjamas. 2014-05-14 12:51:24 +02:00
Goffi
9905e14d0c core (log): added "custom" backend 2014-05-08 19:11:20 +02:00
Goffi
2aeada884e core (logs): workaround for pyjamas bug 2014-05-08 17:16:15 +02:00
Goffi
2802250596 core (log/standard backend): added "%(profile)s" format management 2014-05-05 20:16:13 +02:00
Goffi
ad9c41cbc2 core(log): standard backend: colors are now checked on a per handler basis 2014-05-05 20:16:08 +02:00
Goffi
39989cc985 primitivus: use of new logging system:
- default output is \\memory
    - logs can be seen with :messages command
    - now useless writeLog method has been removed
2014-05-05 20:12:19 +02:00
Goffi
233d4b4268 core (log): added magic %(profile)s key to log_fmt:
if %(profile)s is used in log_fmt, SàT try to find profile value using introspection. This is for debugging purpose only, *DO NOT* use in production. This key don't work (yet ?) with standard backend, and will not work in every frontend.
2014-05-05 18:58:34 +02:00
Goffi
ba103161d5 core (log): refactoring + twisted backend:
- configuration is now done with classes, so inheritance is possible
    - twisted backend now use twisted log methods
    - log not produced by SàT directly in twisted backend are captured by an observer (twistedObserver) and sent back to SàT logging chain, with the "twisted" logger.
    - \\default output use normal twistd output, except in debug mode where it add an stdout output in addition to the log file.
    - when log_colors = True, colors are enabled only where it's possible (tty out), when log_colors=force colors are always enabled.
    - fixed some bad log.xxx calls
2014-05-05 18:58:34 +02:00
Goffi
737e784c3d core (log): added advanced feature to basic backend (colors/formatting/level and logger filtering) 2014-05-05 18:58:34 +02:00
Goffi
64384dc8bf core (logs): added formatting, name filter and outputs management:
- formatting is inspired from, and use when possible, standard logging. "message", "levelname", and "name" are the only format managed, depending on backend more can be managed (standard backend formats are specified in official python logging doc)
    - name filter use regular expressions. It's possible to log only plugins with SAT_LOG_LOGGER="^sat.plugins". To log only XEPs 96 & 65, we can use SAT_LOG_LOGGER='(xep_0095|xep_0065)'
    - output management use a particular syntax:
        - output handler are name with "//", so far there are "//default" (most of time stderr), "//memory" and "//file"
        - options can be specified in parenthesis, e.g. "//memory(50)" mean a 50 lines memory buffer (50 is the current default, so that's equivalent to "//memory")
        - several handlers can be specified: "//file(/tmp/sat.log)//default" will use the default logging + a the /tmp/sat.log file
        - if there is only one handler, it use the file handler: "/tmp/sat.log" is the same as "//file(/tmp/sat.log)"
    - not finished, need more work for twisted and basic backends
2014-05-05 18:58:34 +02:00
Goffi
317342b616 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
2014-04-19 20:11:23 +02:00
Goffi
dc5c042fe7 core (log): twisted backend use logging methods instead of log.msg 2014-04-19 16:48:26 +02:00
Goffi
f05724db74 core: logging refactoring, first step:
- added a core.log module
    - 3 backends can be used: basic, standard (python's logging module) or twisted
    - colors can be used
    - the module has been made to be used by frontends, it should work in exotic environments like pyjamas
    - logging basic configuration is now made in sat.tac
    - core.log configuration is inspired from python standard logging, and use it when possible
    - getLogger should be used the same way as for standard logging
2014-04-19 00:02:38 +02:00