Skip to content

Commit

Permalink
Add audit logging to sys.stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
r0x0d committed Jan 7, 2025
1 parent fadb2f7 commit 256bbd9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion command_line_assistant/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@
"formatter": "audit",
"mode": "a",
},
"audit_journald": {
"class": "logging.StreamHandler",
"stream": "ext://sys.stdout",
"formatter": "audit",
},
},
"loggers": {
"root": {"handlers": ["console"], "level": "DEBUG"},
"audit": {
"handlers": ["audit_file", "console"],
"handlers": ["audit_file", "audit_journald", "console"],
"level": "INFO",
"propagate": False,
},
Expand Down Expand Up @@ -110,6 +115,13 @@ def format(self, record: logging.LogRecord) -> str:
def _create_audit_formatter(config: Config) -> AuditFormatter:
"""Internal method to create a new audit formatter instance.
Note:
This appears to be not used, but the logging class will call this
function to initialize the formatter options for audit logger.
Do not remove this function, only if there is a better idea on how to
do it.
Args:
config (Config): The application configuration
Expand Down

0 comments on commit 256bbd9

Please sign in to comment.