-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.py
More file actions
41 lines (34 loc) · 1.06 KB
/
Copy pathtest.py
File metadata and controls
41 lines (34 loc) · 1.06 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
from enhanced_logging import getLogger, StreamHandler, Formatter, WARNING
log = getLogger('a')
console = StreamHandler()
log.addHandler(console)
formatter = Formatter('%(asctime)s %(levelname)s %(message)s')
console.setFormatter(formatter)
def test_interpolation():
var1 = 123
var2 = 'abc'
var_complex = {'a':1, 2:'c', 3:[1,'a','b','c']}
log.warn("str:[[var1]], [[var2]]")
log.warn("repr:{{var1}}, {{var2}}")
log.fatal("str with name:[[var1?]], [[var2?]]")
log.critical("repr with name:{{var1?}}, {{var2?}}")
log.warn("complex: {{ var_complex? }}")
log.warn("tee to stdout: [[var2]]", tee_stdout=True)
@log.SmartPrint
def test_print():
abc = 1234
print "hello",
print 'world',
print '...'
print "info, this is info {{abc?}}"
print "error, this is error"
@log.SmartPrint(default_level=WARNING)
def test_print2():
a='local value test'
d= {1:2,3:None, '5':[7]}
print "hello2, {{a?}}"
print "info2, this is info, {{d?}}"
print "error2, this is error"
#test_interpolation()
test_print()
test_print2()