/usr/share/pyshared/irc/logging.py is in python-irc 8.5.3+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | from __future__ import absolute_import
import logging
def log_level(level_string):
"""
Return a log level for a string
"""
return getattr(logging, level_string.upper())
def add_arguments(parser):
"""
Add arguments to an ArgumentParser or OptionParser for purposes of
grabbing a logging level.
"""
adder = (
getattr(parser, 'add_argument', None)
or getattr(parser, 'add_option')
)
adder('-l', '--log-level', default=logging.INFO, type=log_level,
help="Set log level (DEBUG, INFO, WARNING, ERROR)")
def setup(options, **kwargs):
"""
Setup logging with options or arguments from an OptionParser or
ArgumentParser. Also pass any keyword arguments to the basicConfig
call.
"""
params = dict(kwargs)
params.update(level=options.log_level)
logging.basicConfig(**params)
|