Skip to content

Commit

Permalink
TODO: Make rsyslog logging optional
Browse files Browse the repository at this point in the history
  • Loading branch information
cinek810 committed Jan 28, 2022
1 parent bbfb3d7 commit c910a2d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions ansible_deploy/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import argparse
import logging
import datetime
from logging import handlers as log_han
#TODO: Add an option to explicitely enable syslog logging
#from logging import handlers as log_han


LOGNAME = "ansible-deploy_execution_{}.log"
Expand Down Expand Up @@ -33,10 +34,11 @@ def set_logging(log_dir: str, name: str, timestamp: str):
formatter = logging.Formatter("%(asctime)s [%(levelname)s]: %(message)s")
console_formatter = logging.Formatter("\n%(asctime)s [%(levelname)s]: %(message)s\n")

rsys_handler = log_han.SysLogHandler(address="/dev/log")
rsys_handler.setFormatter(formatter)
rsys_handler.setLevel(logging.ERROR)
logger.addHandler(rsys_handler)
# TODO: Add an option to explicitly enable syslog logging
# rsys_handler = log_han.SysLogHandler(address="/dev/log")
# rsys_handler.setFormatter(formatter)
# rsys_handler.setLevel(logging.ERROR)
# logger.addHandler(rsys_handler)

console_handler = logging.StreamHandler()
console_handler.setFormatter(console_formatter)
Expand Down

0 comments on commit c910a2d

Please sign in to comment.