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

Consider moving away from Bunyan #286

Closed
NuSkooler opened this issue Jun 4, 2020 · 8 comments
Closed

Consider moving away from Bunyan #286

NuSkooler opened this issue Jun 4, 2020 · 8 comments
Labels
feedback requested Requesting feedback on design, etc.

Comments

@NuSkooler
Copy link
Owner

Bunyan has worked amazingly well and I'm very happy with it overall. However, it at least appears to have become a dead project. See here and [here](https://github.com/trentm/node-bunyan/issues/586], etc.

Consider moving away from Bunyan to something similar:

  • JSON based logging
  • Pretty-printer
  • Similar enough syntax that the upgrade is minimal. The general signature for log methods is ([object], message)
  • Log rotation (may need to be separate, but should be built in to ENiGMA)

Pino seems to be a continuation of the Bunyan spirit. One thing that is missing is log rotation, so something else would need to be created here.

Others?

@NuSkooler NuSkooler added the feedback requested Requesting feedback on design, etc. label Jun 4, 2020
@davestephens
Copy link
Collaborator

davestephens commented Jun 4, 2020 via email

@NuSkooler
Copy link
Owner Author

NuSkooler commented Jun 4, 2020

Funnily enough I'm working on a massive structured logging project at work
at the moment, and the general consensus is "JSON sucks for logs"

At my work place we just moved to JSON for a number of logs for the exact opposite reason. 😆

I'm not sure when you don't have the most basic of tooling (tail is a tool; piping to bunyan currently is part of the same pipeline). I suppose if you load a log into a text editor, but I just dump it all through the processor first even if handed a .log file. With systemd you have a pure binary format, but use journalctl to view it (and extract to text if you want in a number of formats including JSON). I've looked at logfmt a number of times. From their main page:

In development, a log output formatter can then give the msg field special treatment by displaying it in way that a human can easily read (along with other special fields like level)

(they suggest using a formatter because this sucks):

level=info msg="Stopping all fetchers"
  tag=stopping_fetchers id=ConsumerFetcherManager-1382721708341
  module=kafka.consumer.ConsumerFetcherManager

But this is nice:

info | Stopping all fetchers          module=kafka.consumer.ConsumerFetcherManager
info | Performing log compaction      module=kafka.compacter.LogCompactionManager
info | Performing garbage collection  module=kafka.cleaner.GarbageCollectionManager
info | Starting all fetchers          module=kafka.consumer.ConsumerFetcherManager

Perhaps it would be nice if the log allowed backends for particular formats?

@coolacid
Copy link
Contributor

coolacid commented Jun 4, 2020

In $day job, my team uses python, so you may have to extrapolate a bit.
The python logging system supports a msg, and extra

  • msg is a human readable message that describes the error. This is what is used in normal file/console logging handlers
  • extra is a dict with structured important info

We then built a custom logging handler that takes the msg and extra bits for forwarding to a message queue for handling.

If nodejs doesn't have something like this directly, it might be worth having an internal class that implements the same sort of details - thus, the end user can get the info they need.

@NuSkooler
Copy link
Owner Author

@coolacid This is essentially what ENiGMA already does:

Example:

const extra = { // usually you'd inline this, but for illustration
  foo : "bar",
  baz : 1234,
};

log.error(extra, "Something went terribly wrong!");

@coolacid
Copy link
Contributor

coolacid commented Jun 4, 2020

@NuSkooler This is what I get for reading email and not looking at code (that I haven't looked at in a while).

Having said that, as a part time dev, part time pipeline designer, I'd go with the last statement in your last message Perhaps it would be nice if the log allowed backends for particular formats?

@davestephens
Copy link
Collaborator

davestephens commented Jun 4, 2020 via email

@NuSkooler
Copy link
Owner Author

It looks like Pino allows for most of what is being asked for via transports/etc. E.g. one could simply plug a transport that outputs to format $foo or sends to $bar, so on.

@vordimous
Copy link

https://github.com/trentm/node-bunyan/releases/tag/2.0.4 release is out. should this ticket be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback requested Requesting feedback on design, etc.
Projects
None yet
Development

No branches or pull requests

4 participants