https://github.com/ivan-kleshnin/loggers-compared
JS logging solutions compared
https://github.com/ivan-kleshnin/loggers-compared
Last synced: 7 months ago
JSON representation
JS logging solutions compared
- Host: GitHub
- URL: https://github.com/ivan-kleshnin/loggers-compared
- Owner: ivan-kleshnin
- Created: 2016-11-02T12:29:42.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-22T15:35:37.000Z (over 8 years ago)
- Last Synced: 2025-02-01T22:12:52.867Z (9 months ago)
- Size: 10.7 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Logging solutions compared
**Note: info is outdated. At this moment we use [PinoJS](https://github.com/pinojs/) and couldn't be happier. PinoJS is basically a better (cleaned and tuned) version of Bunyan logger used by NodeJS team**.
*The abscence of feature is not automatically BAD just and the presence is not automatically GOOD.*
### Features
Debug
Log4Js
Winston
Levels
1
5
6
Custom Levels
-
+
+
Level Filter
-
+
+
Custom Loggers
+
+
+
Logger Filter
+
+
+
Formats
-
+
+
Custom Formats
-
+
+
Transports
console
console, file, SMTP
console, file, SMTP
Custom Transports
-
+
+
File Rotation
-
+
+
JSON support
no
no
yes
Specifics
profiling
logger wildcards
...
profiling
querying(!)
### Support
https://npmcompare.com/compare/debug,log4js,winston
### Notes
* [Morgan](https://github.com/expressjs/morgan) – purpose? Trivial to implement on top of selected logger.
* JSON logging – [arguable](https://news.ycombinator.com/item?id=3896833).
Initially I felt like Log4JS has better defaults so decided to stick with it.
Then I've found a significant drawback: Log4JS wants you to attach **transports** (called **appenders** there) to categories
rather than loggers themselves. So you cannot define levels per transports per loggers.I may be wrong, but I belive this (basic) case is not possible to configure with Log4JS:
```
WINSTON
mainLogger
transports
console
DEBUG
file
INFO
SMTP
ERROR
```
Winston also understands exceptions so```js
try {
throw Error("bad")
} catch (err) {
logger.error(err)
}
```logs valid JSON (note `\n`) (plain text is also configurable).
```json
{"message":"bad","stack":"Error: bad\n at Object. (/.../test/winston.js:14:8)\n at Module._compile (module.js:573:32)\n at Object.Module._extensions..js (module.js:582:10)\n at Module.load (module.js:490:32)\n at tryModuleLoad (module.js:449:12)\n at Function.Module._load (module.js:441:3)\n at Module.runMain (module.js:607:10)\n at run (bootstrap_node.js:382:7)\n at startup (bootstrap_node.js:137:9)\n at bootstrap_node.js:497:3","level":"error","timestamp":"2016-11-07T09:28:41.799Z"}
```Usage experience: Winston is hands down better than Log4JS in almost all aspects.