mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-26 11:23:46 +03:00
22 lines
587 B
Python
22 lines
587 B
Python
|
import sys
|
||
|
import logging
|
||
|
|
||
|
|
||
|
for arg in sys.argv:
|
||
|
if arg.startswith('--telethon-log='):
|
||
|
level = getattr(logging, arg.split('=')[1], None)
|
||
|
if not isinstance(level, int):
|
||
|
raise ValueError('Invalid log level: %s' % level)
|
||
|
print('Using log level', level, 'which is', arg.split('=')[1])
|
||
|
logging.basicConfig(level=level)
|
||
|
|
||
|
|
||
|
class Logger:
|
||
|
def __init__(self):
|
||
|
setattr(self, 'd', logging.debug)
|
||
|
setattr(self, 'i', logging.info)
|
||
|
setattr(self, 'w', logging.warning)
|
||
|
setattr(self, 'e', logging.error)
|
||
|
|
||
|
Log = Logger()
|