Vous êtes sur la page 1sur 1

"""

Verbosity levels:
--------------------Level
Value
--------------------CRITICAL
50
ERROR
40
WARNING
30
INFO
20
DEBUG
10
UNSET
0
--------------------"""
import socket
#Local configuration
#import logging
#FORMAT = '%(asctime)s %(levelname)s: %(message)s'
#logging.basicConfig(format=FORMAT, level=logging.DEBUG)#, filename='/tmp/dmui.l
og') #/var/log/dmui.log
#/var/log/stuff.txt
#exp
import logging
import logging.handlers
logger = logging.getLogger('myLogger')
logger.setLevel(logging.INFO)
#add handler to the logger socket (SOCK_STREAM for stream sockets and SOCK_DGRA
M)
handler = logging.handlers.SysLogHandler(address=('localhost', 514), socktype=so
cket.SOCK_DGRAM)
#add formatter to the handler
FORMAT = '%(asctime)s %(levelname)s: %(message)s'
formatter = logging.Formatter(FORMAT)
#formatter = logging.Formatter('Python: { "loggerName":"%(name)s", "asciTime":"%
(asctime)s", "pathName":"%(pathname)s", "logRec$
handler.formatter = formatter
logger.addHandler(handler)