Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change log format order ? #388

Closed
byt3bl33d3r opened this issue Dec 25, 2021 · 5 comments · Fixed by #577
Closed

How to change log format order ? #388

byt3bl33d3r opened this issue Dec 25, 2021 · 5 comments · Fixed by #577

Comments

@byt3bl33d3r
Copy link

Heya,

Amazing project. I've started using structlog for all my stuff. This is a really dumb question but I honestly couldn't find it "spelled out" for me anywhere.

I'm trying to change the log format of structlogs. This can be accomplished by a format string using Python's stdlib logger.

Basically my current log output is the following:

 2021-12-25 00:08:19 [debug    ] running in verbose mode        [myapp]

I want to put the logger name before the log level, e.g.:

 2021-12-25 00:08:19 [myapp] [debug    ] running in verbose mode

How does one accomplish this?

@hynek
Copy link
Owner

hynek commented Dec 25, 2021

Unfortunately, that's currently not supported. You can copy-paste ConsoleRenderer from dev.py and just adjust the order in there. :)

@byt3bl33d3r
Copy link
Author

gotchu. Thanks for the response!

@atugushev
Copy link

@hynek I wonder if you are interested in this feature. I'd like to invest some time here.

@hynek
Copy link
Owner

hynek commented Oct 30, 2023

I think this is a bit more complicated than it sounds, because it interacts with #341 and should be tackled together.

I'm thinking something like [Column("timestamp", foreground="green", background="violet"), Column("event", ...)]

@hynek
Copy link
Owner

hynek commented Dec 20, 2023

Please everyone interested, look/comment at/on #577.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants