https://github.com/mrshoenel/js-log-client
A generic node.js client to log messages cross-platform. Since v2.0.0, it is supposed to be functionally equal to the logging in util-dotnet.
https://github.com/mrshoenel/js-log-client
logging nodejs remote
Last synced: about 2 months ago
JSON representation
A generic node.js client to log messages cross-platform. Since v2.0.0, it is supposed to be functionally equal to the logging in util-dotnet.
- Host: GitHub
- URL: https://github.com/mrshoenel/js-log-client
- Owner: MrShoenel
- Created: 2018-03-05T15:30:16.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T17:50:12.000Z (over 3 years ago)
- Last Synced: 2024-04-24T13:45:11.773Z (about 2 years ago)
- Topics: logging, nodejs, remote
- Language: JavaScript
- Homepage:
- Size: 166 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# LogClient
LogClient (or: `log-client`) is a universal module for nodejs or JavaScript applications in general for distributed logging using various transport methods. The concept of this logger is based on `Microsoft.Extensions.Logging`.
## Install via npm [](https://www.npmjs.com/package/sh.log-client)
`npm install sh.log-client`
## Included Loggers
Currently, this client includes the following loggers:
* __`BaseLogger`__ the abstract base-class for all loggers that includes neccessary functionality, only having its `log()`-method abstract.
* __`BaseScope`__ the base-class for scopes
* __`ColoredConsoleLogger`__ a logger that outputs to the console's streams (info, warning, error) and is configurable w.r.t. to which level should be logged to which stream. Also supports colors.
* __`DevNullLogger`__ a dummy logger that discards all messages and is always enabled
* __`InMemoryLogger`__ and __`InMemoryLogMessage`__ a logger and its message to store log messages in memory. Supports specifying a maximum capacity so that only the newest messages are kept.
* __`DualLogger`__ a logger that forwards all logging-calls to two other loggers without modifying them.
* __`WrappedLogger`__ a logger that wraps and mimics an original logger (`TLog1`) and also forwards any logging calls to a 2nd copy-logger (`TLog2`). This is an extension to the *DualLogger*.
* __`StreamLogger`__ a logger that writes messages to a `Writable`-stream. Supports different streams per log level.
## Included Extras
Currently, these extras are included:
* __`LoggerPipe`__ is a `Writable` stream that encapsulates any of the above loggers and writes (pipes) all chunks to its log-method. This class is useful when a stream shall be piped to a logger (e.g. when having a logger for each of a process' streams).
## Write and contribute your own Loggers
Writing an own logger is as simple as extending `BaseLogger`. Please, submit a _pull-request_ if you want to contribute your own logger to this repository.
## Breaking changes since version 2.0.0
The `log-client` is supposed to be a functionally equivalent implementation of the logging functionalities found in `util-dotnet` (https://github.com/MrShoenel/util-dotnet).
The concept of `Transporter`s has been removed entirely.