Mercurial > libervia-backend
comparison src/core/sat_main.py @ 991:05e02f8b7eb4
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
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 19 Apr 2014 00:02:38 +0200 |
parents | 3a96920c07b7 |
children | 301b342c697a |
comparison
equal
deleted
inserted
replaced
990:f0e407709d8e | 991:05e02f8b7eb4 |
---|---|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | 19 |
20 from sat.core.i18n import _, languageSwitch | 20 from sat.core.i18n import _, languageSwitch |
21 from twisted.application import service | 21 from twisted.application import service |
22 from twisted.internet import defer | 22 from twisted.internet import defer |
23 | |
24 from twisted.words.protocols.jabber import jid, xmlstream | 23 from twisted.words.protocols.jabber import jid, xmlstream |
25 from twisted.words.xish import domish | 24 from twisted.words.xish import domish |
26 | |
27 from twisted.internet import reactor | 25 from twisted.internet import reactor |
28 | |
29 from wokkel.xmppim import RosterItem | 26 from wokkel.xmppim import RosterItem |
30 | |
31 from sat.bridge.DBus import DBusBridge | 27 from sat.bridge.DBus import DBusBridge |
32 import logging | 28 import logging |
33 from logging import debug, info, warning, error | 29 from logging import debug, info, warning, error |
34 | 30 |
35 import sys | 31 import sys |
47 try: | 43 try: |
48 from collections import OrderedDict # only available from python 2.7 | 44 from collections import OrderedDict # only available from python 2.7 |
49 except ImportError: | 45 except ImportError: |
50 from ordereddict import OrderedDict | 46 from ordereddict import OrderedDict |
51 | 47 |
52 ### logging configuration FIXME: put this elsewhere ### | |
53 logging.basicConfig(level=logging.DEBUG, | |
54 format='%(message)s') | |
55 ### | |
56 | 48 |
57 sat_id = 0 | 49 sat_id = 0 |
58 | 50 |
59 | 51 |
60 def sat_next_id(): | 52 def sat_next_id(): |