Remove main method from library

This commit is contained in:
Marcel Schwarz 2024-01-25 15:19:21 +01:00
parent 9824346656
commit 0d66d6c674

View File

@ -1,6 +1,4 @@
# Logging
import atexit import atexit
import datetime
import datetime as dt import datetime as dt
import json import json
import logging import logging
@ -81,7 +79,7 @@ class JSONFormatter(logging.Formatter):
return message return message
def get_logger(name: str) -> logging.Logger: def get_stdout_logger(name: str) -> logging.Logger:
json_formatter = JSONFormatter(fmt_keys={ json_formatter = JSONFormatter(fmt_keys={
"level": "levelname", "level": "levelname",
"message": "message", "message": "message",
@ -109,14 +107,3 @@ def get_logger(name: str) -> logging.Logger:
logger.handlers = [queue_handler] logger.handlers = [queue_handler]
return logger return logger
def main():
log = get_logger(__name__)
log.info("Was geht\n los da rein", extra={"asd": 1})
log.debug("Was geht\n los da rein",
extra={"asd": 1, "laaa": "", "da": datetime.datetime.now(tz=datetime.UTC), "set": {12, 45}})
if __name__ == '__main__':
main()