Skip to content

Commit

Permalink
fix(logging): catch permsission error
Browse files Browse the repository at this point in the history
Closes #44
  • Loading branch information
rcarriga committed Jun 10, 2021
1 parent b2b9caf commit 2032c74
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions rplugin/python3/ultest/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,17 @@ def create_logger() -> UltestLogger:
logging._srcfile = None
format.pop(-3)
format.pop(-2)
handler = handlers.RotatingFileHandler(
logfile, maxBytes=20 * 1024, backupCount=1
)
handler.formatter = logging.Formatter(
" | ".join(format),
datefmt="%H:%M:%S",
)
logger.addHandler(handler)
try:
handler = handlers.RotatingFileHandler(
logfile, maxBytes=20 * 1024, backupCount=1
)
handler.formatter = logging.Formatter(
" | ".join(format),
datefmt="%H:%M:%S",
)
logger.addHandler(handler)
except PermissionError:
...
logger.setLevel(level)
logger.info("Logger created")
return logger
Expand Down

0 comments on commit 2032c74

Please sign in to comment.