Skip to content

Added a debugging log stream for pretty console logging#49

Merged
d00rman merged 3 commits into
wikimedia:masterfrom
Pchelolo:pretty
Apr 26, 2016
Merged

Added a debugging log stream for pretty console logging#49
d00rman merged 3 commits into
wikimedia:masterfrom
Pchelolo:pretty

Conversation

@Pchelolo

Copy link
Copy Markdown
Contributor

In this ticket an option for pretty human-readable console logs for service-runner is requested. I find reading JSON logs painful too, so here's a debug stream that outputs nice color-coded logs with nice expanded stack-traces etc.

Usage: simply add a type: debug stream to logger config.

@d00rman

d00rman commented Sep 28, 2015

Copy link
Copy Markdown
Contributor

Hm. Not sure we should use node-bunyan-prettystream, as it looks like it's not maintained any more - last commit was 2 years ago and there are 4 open issues and 11 PRs opened against it. Other forks, like hadfieldn's include some of the PRs and some other improvements. The main drawback I see in the original module is the lack of support for circular references.

@d00rman

d00rman commented Sep 28, 2015

Copy link
Copy Markdown
Contributor

I'm also not in favour of this being a dependency for service-runner. If we do choose to include a package, it should definitely go in the devDependencies and should be require()d iff the debug log type is chosen. On that note, I can't escape the feeling the name debug is misleading. Perhaps pretty-out or something similar would be more appropriate.

@d00rman

d00rman commented Sep 28, 2015

Copy link
Copy Markdown
Contributor

Also, note that npm start | node_modules/.bin/bunyan pretty-prints the logs, so I wonder if this should be even implemented.

@Pchelolo

Copy link
Copy Markdown
Contributor Author

@d00rman hm, the npm start | node_modules/.bin/bunyan feels like a better approach. I didn't know it can do this.

If yurik would agree on the ticket, I'll close this PR.

@Pchelolo

Copy link
Copy Markdown
Contributor Author

@d00rman Actually, I've found a use-case for this. When running tests, npm test | node_modules/.bin/bunyan looses mocha's color-coding and stuff, while it's still handy to see logs in pretty format in case a test is failing. So, adding this pretty-out mode to test configs would be a nice thing. What do you think?

@d00rman

d00rman commented Sep 30, 2015

Copy link
Copy Markdown
Contributor

@Pchelolo I think that's a minor corner case and that in that context we'd be just adding bloat to the package. @wikimedia/services thoughts?

@gwicke

gwicke commented Oct 1, 2015

Copy link
Copy Markdown
Member

I'm also leaning towards keeping things simple. The mocha use case seems to be pretty borderline.

@Pchelolo Pchelolo closed this Oct 5, 2015
@Pchelolo Pchelolo reopened this Apr 25, 2016
@Pchelolo

Pchelolo commented Apr 25, 2016

Copy link
Copy Markdown
Contributor Author

I've reopened this pull request as @nyurik found one more good use-case for this capability: https://phabricator.wikimedia.org/T133611

Also updated the patch according to all the comments.

@d00rman
d00rman merged commit e59c2ad into wikimedia:master Apr 26, 2016
@d00rman

d00rman commented Apr 26, 2016

Copy link
Copy Markdown
Contributor

Published as v1.2.2

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 this pull request may close these issues.

3 participants