mirror of
https://github.com/niess/python-appimage.git
synced 2025-07-21 12:51:16 +02:00
32 lines
667 B
Python
32 lines
667 B
Python
import logging
|
|
|
|
|
|
__all__ = ['debug', 'log']
|
|
|
|
|
|
# Configure the logger
|
|
logging.basicConfig(
|
|
format='[%(asctime)s] %(message)s',
|
|
level=logging.ERROR
|
|
)
|
|
logging.getLogger('python-appimage').setLevel(logging.INFO)
|
|
|
|
|
|
def log(task, fmt, *args):
|
|
'''Log a standard message
|
|
'''
|
|
logging.getLogger('python-appimage').info('%-8s ' + fmt, task, *args)
|
|
|
|
|
|
def debug(task, fmt, *args):
|
|
'''Report some debug information
|
|
'''
|
|
logging.getLogger('python-appimage').debug('%-8s ' + fmt, task, *args)
|
|
|
|
|
|
def set_level(level):
|
|
'''Set the threshold for logs
|
|
'''
|
|
level = getattr(logging, level)
|
|
logging.getLogger('python-appimage').setLevel(level)
|