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

Customise logs format #63

Open
adamu opened this issue May 21, 2020 · 4 comments
Open

Customise logs format #63

adamu opened this issue May 21, 2020 · 4 comments

Comments

@adamu
Copy link

adamu commented May 21, 2020

It would be nice to be able to customize the output of the logs command. Right now, there is a lot of duplicated data before any meaningful log is printed, which means it's not possible to view the logs nicely in any standard-width terminal window. For example:

2020-05-21T07:33:04.257862+00:00 funky-slugggy-name[funky-slugggy-name-1231231231-dgdfgg]: web.1 | actual app log goes here

Any app using a logging framework will also include a timestamp at the start of the log statement, which means the timestamp is logged twice in that case too.

My screen fits 238 characters, and 110 of those (46%) are the prefix.

@adamu
Copy link
Author

adamu commented May 21, 2020

If you're willing to consider this, I'm happy to give it a go, although it's been over 10 years since I wrote any python 🐍. I'm thinking something like: assuming the incoming log from the API is standard format, parse it with a regular expression and combine that with configured settings to output the desired prefix.

@jesseshieh
Copy link
Contributor

Sorry about that. Yeah, the logging is definitely verbose, but we figured it was better to have too much information than not enough. Would it be sufficient to just pipe the output through another program to trim the output? For example, awk or a custom script?

For example, sometimes I'll do this

gigalixir logs | cut -d'|' -f2

@adamu
Copy link
Author

adamu commented May 21, 2020

Thanks for the pipe suggestion, that works well. I thought it might be helpful to include the functionaly as part of the cli for the benefit of others, but happy to use a local alias.

@jesseshieh
Copy link
Contributor

I think it could make sense to keep the log format trimmed by default with a verbose option to show the full lines. Would you be willing to implement something like that?

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

No branches or pull requests

2 participants