Python/logging

From Wiki
< Python
Revision as of 15:39, 14 December 2018 by Marcluer (talk | contribs) (Die Seite wurde neu angelegt: „<pre> import logging import logging.handlers LOG_FILENAME = 'StatusLight.log' log = logging.getLogger('log') log.setLevel(logging.INFO) handler = logging.hand…“)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
import logging
import logging.handlers

LOG_FILENAME = 'StatusLight.log'
log = logging.getLogger('log')
log.setLevel(logging.INFO)
handler = logging.handlers.RotatingFileHandler(LOG_FILENAME, maxBytes=5*1024*1024, backupCount=5)
log.addHandler(handler)

log.info("hello")