Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from logging import debug as dbg, info as inf, warn as wrn, error as err, fatal as ftl
- from settings import LOG_LEVEL
- def __genLogWrapper(f):
- def logwith(*l):
- calframe = inspect.getouterframes(inspect.currentframe())
- if len(calframe)>1:
- frame=calframe[1]
- mod=os.path.splitext(os.path.basename(frame[1]))[0]
- func="."+frame[3] if frame[3] != "<module>" else ""
- f(" ".join([str(i) for i in (mod+func+":"+str(frame[2])+">\n",)+l]))
- return logwith
- debug, info, warn, error, fatal=map(__genLogWrapper, [dbg, inf, wrn, err, ftl])
Advertisement
Add Comment
Please, Sign In to add comment