-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathlog.py
More file actions
25 lines (20 loc) · 687 Bytes
/
Copy pathlog.py
File metadata and controls
25 lines (20 loc) · 687 Bytes
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
import os
import sys
import logging
import inspect
logging.basicConfig(format='[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s')
log = logging.getLogger('crib')
log.setLevel(logging.INFO)
#handler = logging.StreamHandler(sys.stdout)
#log_format = logging.Formatter('[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s','%m-%d %H:%M:%S')
#log.setFormatter(log_format)
#handler.setFormatter(log_format)
#log.addHandler(handler)
def log_detail( msg ):
stack = inspect.stack()[1]
file = os.path.basename( stack[1] )
msg = 'Error: {} @ {}:{}'.format (msg, file, stack[2] )
print(msg)
return msg
if __name__ == "__main__":
pass