-
Notifications
You must be signed in to change notification settings - Fork 11
/
loggers.py
executable file
·42 lines (33 loc) · 1.27 KB
/
loggers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Copyright 2004-2010 Grant T. Olson.
# See license.txt for terms.
import logging, logging.handlers
#so root logger doesn't log children's info messages
rootLogger = logging.getLogger('')
rootHandler = logging.StreamHandler()
rootHandler.setLevel(logging.ERROR)
rootLogger.addHandler(rootHandler)
#quick debug messages
debugLogger = logging.getLogger("pyasm.debug")
debugHandler = logging.StreamHandler()
debugHandler.setLevel(logging.DEBUG)
#various loggers
x86sourceLogger = logging.getLogger("pyasm.x86.source")
x86asmLogger = logging.getLogger("pyasm.x86.asm")
x86apiLogger = logging.getLogger("pyasm.x86.api")
x86sourceLogger.setLevel(logging.INFO)
x86asmLogger.setLevel(logging.INFO)
x86apiLogger.setLevel(logging.INFO)
debugLogger.setLevel(logging.INFO)
console = logging.StreamHandler()
console.setLevel(logging.INFO)
formatter = logging.Formatter("%(message)s")
console.setFormatter(formatter)
#x86apiLogger.addHandler(console)
#x86sourceLogger.addHandler(console)
#x86asmLogger.addHandler(console)
socketHandler = logging.handlers.SocketHandler('localhost',
logging.handlers.DEFAULT_TCP_LOGGING_PORT)
x86sourceLogger.addHandler(socketHandler)
x86asmLogger.addHandler(socketHandler)
x86apiLogger.addHandler(socketHandler)
debugLogger.addHandler(socketHandler)