Skip to content
Grant Carthew edited this page Jun 8, 2018 · 20 revisions

perj

A fast, flexible JSON logger.

perj

Use the Wiki sidebar menu on the right to learn how to use perj. 👉

Goals

  • Designed to be integrated (DIY) ✔️
  • Cross platform (Node.js and Browser) ✔️
  • Flexible log and additional property options ✔️
  • Fast ✔️

Features

  • No dependencies.
  • Flexible API (change almost everything).
  • Flexible log methods:
    • Log items can be any number in any order of any type.
  • The first string is nested under the 'msg' key:
    • First string includes a string argument or an Error message.
    • Additional string arguments are nested under the data key.
  • Objects are nested under the 'data' key as an object or array of objects.
  • Repeated string top level properties become hierarchical.
  • Examples to get you started.

Rational

After having some performance issues with a popular Node.js logging package I decided to switch to another logger that is advertised as blasing fast called pino. It's great and you should check it out.

There were a couple of things I found a little restrictive within the pino API. Specifically I wanted to be able to log content in any order without being tied down to a fixed argument list. I also wanted to ensure all extra log data was nested under a root property.

Using pino as a yard stick I created perj to meet my goals.