Merge pull request #366 from shinji-s/logging-fix

Delay initialisation of the python logging so that running setup.py u…
pull/371/head
multibootusb 6 years ago committed by GitHub
commit 1fb5a14498
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -34,12 +34,14 @@ try:
from scripts import admin
from scripts import gen
from scripts import config
from scripts import osdriver
except ImportError:
try:
from .scripts.mbusb_cli import *
from .scripts import admin
from .scripts import gen
from .scripts import config
from .scripts import osdriver
except ImportError:
import scripts
@ -220,6 +222,7 @@ def main():
if __name__ == '__main__':
osdriver.init_logging()
try:
main()
finally:

@ -131,11 +131,11 @@ for func_name in [
]:
globals()[func_name] = getattr(osdriver, func_name)
logging.root.setLevel(logging.DEBUG)
fmt = '%(asctime)s.%(msecs)03d %(name)s %(levelname)s %(message)s'
datefmt = '%H:%M:%S'
the_handler = logging.handlers.RotatingFileHandler(
osdriver.mbusb_log_file(), 'a', 1024*1024, 5)
the_handler.setFormatter(logging.Formatter(fmt, datefmt))
logging.root.addHandler(the_handler)
def init_logging():
logging.root.setLevel(logging.DEBUG)
fmt = '%(asctime)s.%(msecs)03d %(name)s %(levelname)s %(message)s'
datefmt = '%H:%M:%S'
the_handler = logging.handlers.RotatingFileHandler(
osdriver.mbusb_log_file(), 'a', 1024*1024, 5)
the_handler.setFormatter(logging.Formatter(fmt, datefmt))
logging.root.addHandler(the_handler)

Loading…
Cancel
Save