mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-07 19:49:23 +01:00
Added verbose logging level.
This commit is contained in:
parent
fbd4ce26eb
commit
201df375e2
16
src/log.py
16
src/log.py
@ -56,6 +56,8 @@ deadlyExceptions = [KeyboardInterrupt, SystemExit]
|
|||||||
###
|
###
|
||||||
testing = False
|
testing = False
|
||||||
|
|
||||||
|
logging.addLevelName(1, 'VERBOSE')
|
||||||
|
|
||||||
class Formatter(logging.Formatter):
|
class Formatter(logging.Formatter):
|
||||||
_fmtConf = staticmethod(lambda : conf.supybot.log.format())
|
_fmtConf = staticmethod(lambda : conf.supybot.log.format())
|
||||||
def formatTime(self, record, datefmt=None):
|
def formatTime(self, record, datefmt=None):
|
||||||
@ -90,6 +92,9 @@ class Logger(logging.Logger):
|
|||||||
# The traceback should be sufficient if we want it.
|
# The traceback should be sufficient if we want it.
|
||||||
# self.error('Exception string: %s', eStrId)
|
# self.error('Exception string: %s', eStrId)
|
||||||
|
|
||||||
|
def verbose(self, *args, **kwargs):
|
||||||
|
self.log('VERBOSE', *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class StdoutStreamHandler(logging.StreamHandler):
|
class StdoutStreamHandler(logging.StreamHandler):
|
||||||
def disable(self):
|
def disable(self):
|
||||||
@ -168,8 +173,8 @@ class ColorizedFormatter(Formatter):
|
|||||||
return Formatter.format(self, record, *args, **kwargs)
|
return Formatter.format(self, record, *args, **kwargs)
|
||||||
|
|
||||||
# These are public.
|
# These are public.
|
||||||
formatter = Formatter('NEVER SEEN')
|
formatter = Formatter('NEVER SEEN; IF YOU SEE THIS, FILE A BUG!')
|
||||||
pluginFormatter = PluginFormatter('NEVER SEEN')
|
pluginFormatter = PluginFormatter('NEVER SEEN; IF YOU SEE THIS, FILE A BUG!')
|
||||||
|
|
||||||
# These are not.
|
# These are not.
|
||||||
logging.setLoggerClass(Logger)
|
logging.setLoggerClass(Logger)
|
||||||
@ -181,8 +186,8 @@ class ValidLogLevel(registry.String):
|
|||||||
def set(self, s):
|
def set(self, s):
|
||||||
s = s.upper()
|
s = s.upper()
|
||||||
try:
|
try:
|
||||||
level = getattr(logging, s)
|
level = logging._levelNames[s]
|
||||||
except AttributeError:
|
except KeyError:
|
||||||
try:
|
try:
|
||||||
level = int(s)
|
level = int(s)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
@ -219,7 +224,7 @@ conf.registerGlobalValue(conf.supybot.log, 'level',
|
|||||||
will be. Valid values are DEBUG, INFO, WARNING, ERROR, and CRITICAL, in
|
will be. Valid values are DEBUG, INFO, WARNING, ERROR, and CRITICAL, in
|
||||||
order of increasing priority."""))
|
order of increasing priority."""))
|
||||||
conf.registerGlobalValue(conf.supybot.log, 'statistics',
|
conf.registerGlobalValue(conf.supybot.log, 'statistics',
|
||||||
ValidLogLevel(logging.DEBUG, """Determines what level statistics reporting
|
ValidLogLevel('VERBOSE', """Determines what level statistics reporting
|
||||||
is to be logged at. Mostly, this just includes, for instance, the time it
|
is to be logged at. Mostly, this just includes, for instance, the time it
|
||||||
took to parse a message, process a command, etc. You probably don't care
|
took to parse a message, process a command, etc. You probably don't care
|
||||||
about this."""))
|
about this."""))
|
||||||
@ -264,6 +269,7 @@ conf.registerGlobalValue(conf.supybot.log.plugins, 'format',
|
|||||||
|
|
||||||
# These just make things easier.
|
# These just make things easier.
|
||||||
debug = _logger.debug
|
debug = _logger.debug
|
||||||
|
verbose = _logger.verbose
|
||||||
info = _logger.info
|
info = _logger.info
|
||||||
warning = _logger.warning
|
warning = _logger.warning
|
||||||
error = _logger.error
|
error = _logger.error
|
||||||
|
Loading…
Reference in New Issue
Block a user