MCPcopy Index your code
hub / github.com/pyload/pyload / init_logger

Method init_logger

pyLoadCore.py:503–522  ·  view source on GitHub ↗
(self, level)

Source from the content-addressed store, hash-verified

501 self.webserver.start()
502
503 def init_logger(self, level):
504 console = logging.StreamHandler(sys.stdout)
505 frm = logging.Formatter("%(asctime)s %(levelname)-8s %(message)s", "%d.%m.%Y %H:%M:%S")
506 console.setFormatter(frm)
507 self.log = logging.getLogger("log") # settable in config
508
509 if self.config['log']['file_log']:
510 if self.config['log']['log_rotate']:
511 file_handler = logging.handlers.RotatingFileHandler(join(self.config['log']['log_folder'], 'log.txt'),
512 maxBytes=self.config['log']['log_size'] * 1024,
513 backupCount=int(self.config['log']['log_count']),
514 encoding="utf8")
515 else:
516 file_handler = logging.FileHandler(join(self.config['log']['log_folder'], 'log.txt'), encoding="utf8")
517
518 file_handler.setFormatter(frm)
519 self.log.addHandler(file_handler)
520
521 self.log.addHandler(console) #if console logging
522 self.log.setLevel(level)
523
524 def removeLogger(self):
525 for h in list(self.log.handlers):

Callers 1

startMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected