mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 06:49:24 +01:00
Added logging of version of plugin in plugin logs.
This commit is contained in:
parent
9dc2618232
commit
532db9c456
13
src/log.py
13
src/log.py
@ -159,6 +159,19 @@ def getPluginLogger(name):
|
||||
handler.setLevel(-1)
|
||||
handler.setFormatter(pluginFormatter)
|
||||
log.addHandler(handler)
|
||||
if name in sys.modules:
|
||||
# Let's log the version, this might be useful.
|
||||
module = sys.modules[name]
|
||||
try:
|
||||
if hasattr(module, '__revision__'):
|
||||
version = module.__revision__.split()[2]
|
||||
log.info('Starting log for %s (revision %s)', name, version)
|
||||
else:
|
||||
debug('Module %s has no __revision__ string.', name)
|
||||
log.info('Starting log for %s.', name)
|
||||
except IndexError:
|
||||
log.debug('Improper __revision__ string in %s.', name)
|
||||
log.info('Starting log for %s.', name)
|
||||
return log
|
||||
|
||||
def timestamp(when=None):
|
||||
|
Loading…
Reference in New Issue
Block a user