I have set up my logger like this:
import logging
import structlog
class Logging:
@staticmethod
def my_logger() -> logging.Logger:
structlog.configure(
processors=[
structlog.processors.add_log_level,
structlog.processors.TimeStamper(fmt="iso", key="ts"),
structlog.processors.JSONRenderer(),
],
wrapper_class=structlog.make_filtering_bound_logger(logging.INFO),
)
logger = structlog.getLogger()
return logger
Events in Cloudwatch now look like this:
2023-04-05T10:44:52.920+01:00 {"event": "My logging message", "level": "info", "ts": "2023-04-05T09:44:52.919867Z"}
Instead, I want to see the log level right at the beginning like I would with the default logging module:
2023-04-05T10:44:52.920+01:00 [INFO] {"event": "My logging message", "level": "info", "ts": "2023-04-05T09:44:52.919867Z"}
How can I accomplish this?