-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Grant Carthew edited this page May 12, 2018
·
20 revisions
A simple, fast JSON logger.
Documentations is not complete. See the WORKLOG for more detail.
The perj
project has the following goals:
- KISS: Keep it simple smiley. ✔️
- Designed to be integrated rather than used out of the box (DIY). ✔️
- Cross platform (Node.js and Browser) with no platform dependencies. ✔️
- Flexible log and additional property options. ✔️
- Fast. ✔️
- Feature limited. ✔️
- No dependencies.
- 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.
- No transports included (see primary goal).
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.
level | lvl | When to Use |
---|---|---|
fatal |
60 | Stop errors. Process crash. |
error |
50 | Processing failed for a known or unknown reason. |
warn |
40 | Something went wrong however it is not critical. |
info |
30 | Hey Dad? I dug a hole! (see The Castle). |
debug |
20 | When you need to find out where something happened. |
trace |
10 | When you need to know everything that happens. |