Make jwutils.log module somewhat usable

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2017-08-07 18:05:53 +02:00
commit 0aecc8d076
2 changed files with 57 additions and 11 deletions

View file

@ -3,15 +3,18 @@ import jwutils.log
class Object(object): # export
def __init__():
self.log_level = jwutils.log.NOTICE
self.log_level = jwutils.log.level
def log(self, prio, *args):
if self.log_level == jwutils.log.level:
jwutils.log.slog(prio, args)
return
if prio <= self.log_level:
msg = ""
for count, thing in enumerate(args):
msg += ' ' + str(thing)
msg += ' ' + str(*thing)
if len(msg):
print msg[1:]
def debug(self, *args):
self.log(DEBUG, args)
jwutils.log.slog(jwutils.log.DEBUG, args)