https://gitlab.com/oleasteo/oddlog
High-performance payload focused logging library for node.js.
https://gitlab.com/oleasteo/oddlog
inheritance logging node.js object
Last synced: 5 months ago
JSON representation
High-performance payload focused logging library for node.js.
- Host: gitlab.com
- URL: https://gitlab.com/oleasteo/oddlog
- Owner: oleasteo
- License: mit
- Archived: true
- Created: 2016-09-14T06:03:18.520Z (over 8 years ago)
- Default Branch: master
- Last Synced: 2024-11-02T17:03:20.142Z (6 months ago)
- Topics: inheritance, logging, node.js, object
- Stars: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-node-esm - oddlog - high-performance payload focused logging library for node.js. (Packages / Logging)
README
# oddlog - Object driven data logging
[](LICENSE)
[](https://www.npmjs.com/package/oddlog)
[](https://gitlab.com/frissdiegurke/oddlog/commits/master)
[](https://gitlab.com/frissdiegurke/oddlog/commits/master)
[](https://www.npmjs.com/package/oddlog)oddlog is a high-performance payload focused logging library for node.js.
*Being restricted to strings for logging sucks. So we use arbitrary JSON objects instead.*
[](https://gitlab.com/frissdiegurke/oddlog/raw/master/assets/readme-01.png)
```javascript
const oddlog = require("oddlog");
const log = oddlog.createLogger("my-app"), child = log.child({user: "root"});
log
.handleUncaughtExceptions()
.info({random: 42}, "Application startup");
child
.warn({method: "terminate"}, "Procedure initiated");throw new Error("Nah, nothing failed");
```## References
* [Website](https://frissdiegurke.gitlab.io/oddlog)
* [User Guide](https://frissdiegurke.gitlab.io/oddlog/guide)
* [Documentation](https://frissdiegurke.gitlab.io/oddlog/documentation)
* [Source code](https://gitlab.com/frissdiegurke/oddlog)## Installation
```bash
npm install --save oddlog
```## Features
* Payload inheritance
* Stateless and stateful logging APIs
* Multi-transport logging (one log, multiple destinations)
* Source code location logging (for development, not production)
* Payload attribute transformation (e.g. `req`, `res`, `err`)
* Termination methods (ensure all logs have been transferred)
* Suited for libraries (via option flag `shy`)
* CLI for (pretty) output reformatting and filtering of log records
* Threshold logging (cache log records until high severity is logged)## Command-line interface
The CLI `oddlog-cli` is a command-line tool to reformat, prettify and filter message records. It accepts input from
`stdin` and outputs on `stdout`; Thus it suits well for any common operations.```bash
node my-application | oddlog # simply prettify the output of my-application
node my-application | oddlog -vv # increased verbosity to show payload as wellcat logs/app.log | oddlog -vvl info # read (pretty) log records from logs/app.log that are INFO or above
tail -f logs/app.log | oddlog # pretty print latest and future log records within logs/app.log
# this is the recommended way of checking live logs of a running application; it
# allows you to change the filters, etc. without interrupting the process itself.
```For further information take a look into `oddlog --help` or check out the
[oddlog-cli repository](https://gitlab.com/frissdiegurke/oddlog-cli).## License
The source code and all related examples, tests and benchmarks are licensed under
[MIT](https://gitlab.com/frissdiegurke/oddlog/blob/master/LICENSE). If you don't agree to the license, you may not
contribute to the project. Feel free to fork and maintain your custom build thought.## Thanks
Many thanks also to everyone who supports this project by usage, contribution and/or spreading the word!
All contributors may add themselves to the `contributors` field within the *package.json* regardless of the amount of
changes; however *I* won't do it for them.Since this project is inspired by [bunyan](https://www.npmjs.com/package/bunyan), at this point a big *Thanks!* to its
author.## Donations
Donations (dt.: *Schenkungen*) to the author are accepted via [PayPal](https://www.paypal.me/frissdiegurke) and
[Patreon](https://www.patreon.com/frissdiegurke).## Related projects
* [bunyan](https://github.com/trentm/node-bunyan) - The main inspiration for this project.
* [winston](https://github.com/winstonjs/winston) - Some inspiration came from winston as well.