https://github.com/schahriar/lorg
Fast, streamable Object logging made simple.
https://github.com/schahriar/lorg
json logging nodejs object streams
Last synced: 2 months ago
JSON representation
Fast, streamable Object logging made simple.
- Host: GitHub
- URL: https://github.com/schahriar/lorg
- Owner: schahriar
- License: mit
- Created: 2016-07-14T01:06:46.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-08-16T05:11:12.000Z (almost 9 years ago)
- Last Synced: 2025-09-19T05:24:31.752Z (10 months ago)
- Topics: json, logging, nodejs, object, streams
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/lorg
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# **Lorg** - for all your logging needs
----------
Fast, streamable Object logging made simple. Lorg is on average 4 times faster than `console.log` as it buffers and queues logs efficiently in a stream. It also adds additional meta information for better log tracking.
----------
## Getting Started
Install lorg:
```
npm install --save lorg
```
Create a new instance and pipe it to stdout:
```javascript
const Lorg = require('lorg');
const appLog = new Lorg();
appLog.pipe(process.stdout); // Outputs to terminal
```
Log:
```javascript
let values = [1,2,3,4,5];
...
appLog.log({ values });
// Output: {"hello":"World!","_META_":{"time":1489471607584,"type":"log"}}
```
**Lorg will automatically add a `_META_` property with time and type of the log added to it.**
Stream your logs to a file and terminal:
```javascript
const fileStream = fs.createWriteStream('./temp/appLog.log');
appLog.pipe(fileStream);
appLog.pipe(process.stdout);
```
Create multiple log streams:
```javascript
const appLog = new Lorg();
const buildLog = new Lorg();
const fileStream = fs.createWriteStream('./temp/build.log');
appLog.pipe(process.stdout); // Outputs to terminal
buildLog.pipe(fileStream); // Outputs to file
```