Skip to content

Commit

Permalink
Update ad_logger documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
RachelDuffin committed Jul 5, 2024
1 parent 58cf8f1 commit b7a0bff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ad_logger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This removes sensitive information (authentication keys) in log messages (preven

### RunfolderLoggers Class

Creates an RunfolderLoggers object that contains various loggers required by the script that calls it. The loggers created are dictated by the logfiles_config dict provided as input. The class adds an AdLogger object for each logger specified in the logfiles_config and assigns it as an attribute. In this way the RunfolderLoggers object attributes can be used to write to the log files.
Creates a RunfolderLoggers object that contains various loggers required by the script that calls it. The loggers created are dictated by the logfiles_config dict provided as input. The class adds an AdLogger object for each logger specified in the logfiles_config and assigns it as an attribute. In this way the RunfolderLoggers object attributes can be used to write to the log files.

## Usage

Expand Down Expand Up @@ -64,7 +64,7 @@ No log is written to as this module is creating the logger.

## Alerts

No alerts are triggered by this module, as it is creating the logger that sends the alerts to Rapid7.
No alerts are triggered by this module, as it is creating the logger that writes the logs that are used for rapid7 pattern detection.

## Testing

Expand Down
7 changes: 4 additions & 3 deletions ad_logger/ad_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
from config.ad_config import AdLoggerConfig


# Function to remove all loggers
def remove_all_loggers():
def remove_all_loggers() -> None:
"""
Remove all loggers
:return None:
"""
for name in list(logging.Logger.manager.loggerDict.keys()):
if isinstance(logging.Logger.manager.loggerDict[name], logging.Logger):
Expand All @@ -32,11 +32,12 @@ def get_logging_formatter() -> str:
)


def set_root_logger():
def set_root_logger() -> None:
"""
Set up root logger and add stream handler and syslog handler - we only want to add these once
else it will duplicate log messages to the terminal. All loggers named with the same stem
as the root logger will use these same syslog handler and stream handler
:return None:
"""
sensitive_formatter=SensitiveFormatter(get_logging_formatter())
logger = logging.getLogger(AdLoggerConfig.REPO_NAME)
Expand Down

0 comments on commit b7a0bff

Please sign in to comment.