-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Rafael te Boekhorst <[email protected]> Signed-off-by: Tobias Wolf <[email protected]> Co-authored-by: Tobias Wolf <[email protected]>
- Loading branch information
1 parent
d92f3b6
commit 861d23a
Showing
9 changed files
with
86 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import structlog | ||
import logging | ||
|
||
from typing import Any, Dict | ||
|
||
|
||
def configure_logging(config: Dict[str, Any]) -> None: | ||
LOG_LEVEL = getattr(logging, config["level"], logging.INFO) | ||
LOG_TIME_FORMAT = config["format"]["time"] | ||
LOG_RENDERER = config["format"]["renderer"] | ||
|
||
structlog.configure( | ||
wrapper_class=structlog.make_filtering_bound_logger(LOG_LEVEL), | ||
processors=[ | ||
structlog.processors.TimeStamper(fmt=LOG_TIME_FORMAT), | ||
structlog.processors.add_log_level, | ||
], | ||
) | ||
|
||
if LOG_RENDERER == "console": | ||
structlog.configure( | ||
processors=[ | ||
*structlog.get_config()["processors"], | ||
structlog.dev.ConsoleRenderer(), | ||
] | ||
) | ||
else: | ||
structlog.configure( | ||
processors=[ | ||
*structlog.get_config()["processors"], | ||
structlog.processors.JSONRenderer(), | ||
] | ||
) | ||
|
||
|
||
def get_logger() -> structlog.getLogger: | ||
return structlog.get_logger() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from ..module import ModuleHandler | ||
from typing import Dict, Any | ||
|
||
|
||
class MigrateMonitorsHandler(ModuleHandler): | ||
pass | ||
def run(self) -> Dict[str, Any]: | ||
self.logger.info("MigrateMonitorsHandler ran successfully.") | ||
return {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters