improve logging a bit

This commit is contained in:
mike
2024-06-09 06:51:51 -07:00
parent 2e6d268de0
commit 1564f4cf8a
3 changed files with 68 additions and 15 deletions

25
main.py
View File

@ -21,6 +21,27 @@ def main():
help="Verbose/Debug logging mode"
)
parser.add_argument(
"--systemd",
default=False,
dest="systemd",
action="store_true",
help=(
"Pass if this program will be spawned inside systemd"
" or another system that already adds timestamps to log messages."
)
)
parser.add_argument(
"--syslog", "--write-to-syslog",
default=False,
dest="write_to_syslog",
action="store_true",
help=(
"Pass if you'd like this program to write to syslog."
)
)
parser.add_argument(
"--config", "-c",
dest="config_files",
@ -40,7 +61,9 @@ def main():
args = parser.parse_args()
rotator = BackupRotator(
debug=args.debug
debug=args.debug,
systemd=args.systemd,
write_to_syslog=args.write_to_syslog,
)
rotator.run(
configs=args.config_files,