-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest6.py
More file actions
executable file
·82 lines (37 loc) · 1.19 KB
/
test6.py
File metadata and controls
executable file
·82 lines (37 loc) · 1.19 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python3
import os
import time
import traceback
import sys
import abc
import jk_logging
if os.path.isfile("test6-log.json"):
os.unlink("test6-log.json")
def doLogTest(log):
log.trace("This is a test for TRACE.")
log.debug("This is a test for DEBUG.")
log.notice("This is a test for NOTICE.")
log.info("This is a test for INFO.")
log.warning("This is a test for WARNING.")
log.error("This is a test for ERROR.")
log.success("This is a test for SUCCESS.")
log2 = log.descend("Nested log messages ...")
log2.notice("Some log data.")
log3 = log2.descend("Even deeper nested log messages ...")
log3.notice("Some other log data.")
log2 = log.descend("Frequent log messages ...")
log2.info("Some more log data.")
#
print()
print("-- JSONFileLogger --")
jlog = jk_logging.JSONFileLogger.create("test6-log.json")
doLogTest(jlog.descend("TEST"))
print()
print("-- forwarding to ConsoleLogger --")
clog = jk_logging.ConsoleLogger.create()
jlog.forwardTo(clog)
print()
print("-- reconstructing and forwarding to ConsoleLogger --")
clog = jk_logging.ConsoleLogger.create()
jlog2 = jk_logging.JSONFileLogger.create("test6-log.json")
jlog2.forwardTo(clog)