Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make rsyslog optional #8

Merged
merged 1 commit into from
Jan 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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