plugin.makemkvbluray/resources/lib/brlog.py

33 lines
757 B
Python
Raw Normal View History

2012-10-06 12:21:30 +02:00
class BrLog:
__DEBUG = 0
__INFO = 1
__WARN = 2
__ERROR = 3
def __init__(self, prefix = ''):
self.logLevel = self.__INFO
if prefix <> '':
prefix = '-' + prefix
self.prefix = prefix
2014-01-26 15:10:39 +01:00
2012-10-06 12:21:30 +02:00
def setLevel(self, level):
if level >= 0 and level <= 3:
self.logLevel = level
2014-01-26 15:10:39 +01:00
2012-10-06 12:21:30 +02:00
def info(self, message):
self.log(message, self.__INFO)
2014-01-26 15:10:39 +01:00
2012-10-06 12:21:30 +02:00
def debug(self, message):
self.log(message, self.__DEBUG)
2014-01-26 15:10:39 +01:00
2012-10-06 12:21:30 +02:00
def error(self, message):
self.log(message, self.__ERROR)
2014-01-26 15:10:39 +01:00
2012-10-06 12:21:30 +02:00
def warn(self, message):
self.log(message, self.__WARN)
2014-01-26 15:10:39 +01:00
2012-10-06 12:21:30 +02:00
def log(self, message, level):
if self.logLevel <= level:
print '[BR%s %d] %s' %(self.prefix, level, message)