Skip to content

Instantly share code, notes, and snippets.

@yknx4
Created June 16, 2017 18:42
Show Gist options
  • Save yknx4/80d2bfbe63327a65cf535703362a8db2 to your computer and use it in GitHub Desktop.
Save yknx4/80d2bfbe63327a65cf535703362a8db2 to your computer and use it in GitHub Desktop.
Loggers info

Loggers

Winston


Personal favorite :)

Pros

  • > 1 million download in the last month (comunnity acceptance)
  • > 2 years in the market.
  • last updated 3 months ago
  • 185 contributors
  • only 6 dependencies
  • Async (non blocking)
  • simple configuration.
    • global configure
    • global require
  • Built in support console for local
  • Built in Amazon Cloudwatch
  • Build in support for json output
  • Object logging is handled with util.inspect, so it is safe from circular references, but output may not be as useful.
  • Built in profiling tool
  • Support for logging unhandled exceptions

Cons

  • Presumably slower than other options, no really big issue, it may take longer to log, but it is non-blocking.
  • no DEBUG support but can be implemented really easily without monkeypatching or hooking.
  • no Datadog support, but can be implemente really easily without monkeypatching or hooking. (maybe we don't require it, because it writes to a file, and we can just use the daemon to stream that file to Datadog)
  • Lots of configuration, but as it is global configurable, we just configure one and we are good to go.
  • Afaik not built in rog lotation
  • We need to add by ourselves pid and hostname. (Not hard to do)

Bunyan


Pros

  • > 1 million download in the last month (comunnity acceptance)
  • > 3 years in the market. Well known
  • last updated 2 months ago
  • 56 contributors
  • only 5 dependencies (4 of them quasi-optional)
  • Built in log rotation
  • Built in machine metadata (pid, hostname)
  • CLI for filte
  • Build in serializers for express

Cons

  • Instance configuration
    • Requires an instanced logger. (no global)
  • no DEBUG support and will have to deal with a stream.
  • no Datadog support, and will have to deal with a stream. (maybe we don't require it, because it writes to a file, and we can just use the daemon to stream that file to Datadog)
  • Do not automatically handles objects passed to log (it merges them to the output json, so it is prone to collisions). Tho they have optional serializers to better handle this
  • Limited configuration

Pino


Pros

  • > 50 k installs in the last month (Fairly accepted)
  • last updated 1 months ago
  • only 7 dependencies
  • Presumably extremely fast (as their benchmark says)
  • Quite easy configuration

Cons

  • no DEBUG support and they reccomend to use a separate app to handle the output :s
  • no Datadog support and they reccomend to use a separate app to handle the output :s
  • File writing is done by piping the output node index > mylog
  • Not a lot of support for custom transports
  • Kind of new, just 1 year in the market
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment