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

Proposal: A customizable ConsoleWriter output #84

Closed
karmi opened this issue Jul 20, 2018 · 4 comments
Closed

Proposal: A customizable ConsoleWriter output #84

karmi opened this issue Jul 20, 2018 · 4 comments

Comments

@karmi
Copy link
Contributor

karmi commented Jul 20, 2018

Hello, I've recently used zerolog in a project, and I like it very much — many thanks!

One thing I wanted to change was the ConsoleWriter output: I wanted to format the output differently, I wanted to highlight field values, not field names, etc. So I wrote a custom implementation, looking like this (adapting the output from zerolog's README):

Screenshot

I've realized that my needs are probably not unique (see #34), and that it would be nice to expose a customizable ConsoleWriter. Therefore, I've extracted what I did in the project into a library, available at https://github.com/karmi/consolelog, since I didn't want to just blindly send code your way.

My question is: is this something you would consider interesting to have in the zerolog library itself? If so, I can move the implementation into a patch and send a pull request.

@rs
Copy link
Owner

rs commented Jul 20, 2018

Yes, as long as it is backward compatible.

@rs
Copy link
Owner

rs commented Jul 20, 2018

...and does not add extra dependencies.

@karmi
Copy link
Contributor Author

karmi commented Jul 21, 2018

Hi, understood about dependencies, but can you be more specific about "backwards compatibility" — as far as I understand it, the output type is just io.Writer, ie. the contract is in the Write() method. Or is there any other concern?

@rs
Copy link
Owner

rs commented Jul 21, 2018

Just make sure that the current API of the ConsoleWriter still works. Seems like it should not be an issue with the way you pass configuration.

karmi added a commit to karmi/zerolog that referenced this issue Jul 28, 2018
In order to allow customizing the console output, the `zerolog.ConsoleWriter` output
has been refactored, with the formatting logic extracted to separate functions in `consoleFormatters`,
and with the `SetFormatter()` method to re-define the defaults.

Also, the default has been changed to be more sparse and visually attractive.

The logic has been extracted from an external prototype package at <https://github.com/karmi/consolelog>.

A comprehensive example has been added to the README, and a number of tests has been added as well.

Closes rs#84
karmi added a commit to karmi/zerolog that referenced this issue Jul 28, 2018
In order to allow customizing the console output, the `zerolog.ConsoleWriter` output
has been refactored, with the formatting logic extracted to separate functions in `consoleFormatters`,
and with the `SetFormatter()` method to re-define the defaults.

Also, the default has been changed to be more sparse and visually attractive.

The logic has been extracted from an external prototype package at <https://github.com/karmi/consolelog>.

A comprehensive example has been added to the README, and a number of tests has been added as well.

Closes rs#84
karmi added a commit to karmi/zerolog that referenced this issue Jul 30, 2018
In order to allow customizing the console output, the `zerolog.ConsoleWriter` output
has been refactored, with the formatting logic extracted to separate functions in `consoleFormatters`,
and with the `SetFormatter()` method to re-define the defaults.

Also, the default has been changed to be more sparse and visually attractive.

The logic has been extracted from an external prototype package at <https://github.com/karmi/consolelog>.

A comprehensive example has been added to the README, and a number of tests has been added as well.

Closes rs#84
karmi added a commit to karmi/zerolog that referenced this issue Jul 30, 2018
In order to allow customizing the console output, the `zerolog.ConsoleWriter` output
has been refactored, with the formatting logic extracted to separate functions in `consoleFormatters`,
and with the `SetFormatter()` method to re-define the defaults.

Also, the default has been changed to be more sparse and visually attractive.

The logic has been extracted from an external prototype package at <https://github.com/karmi/consolelog>.

A comprehensive example has been added to the README, and a number of tests has been added as well.

Closes rs#84
karmi added a commit to karmi/zerolog that referenced this issue Oct 29, 2018
In order to allow customizing the console output, the `zerolog.ConsoleWriter` output
has been refactored, with the formatting logic extracted to separate functions in `consoleFormatters`,
and with the `SetFormatter()` method to re-define the defaults.

Also, the default has been changed to be more sparse and visually attractive.

The logic has been extracted from an external prototype package at <https://github.com/karmi/consolelog>.

A comprehensive example has been added to the README, and a number of tests has been added as well.

Closes rs#84
@rs rs closed this as completed in 96f91bb Nov 5, 2018
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