1.0.5 • Published 10 months ago

nodejs-lsd-logger v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

Node.js logger for LSD Server npm version

Node.js logger for LSD streaming deamon

Logger writes to small files, depending on current time.

lsd_dir/category_name/year|month|day|hour|minute.log
// for example
lsd_dir/category_name/202302121626.log

All messages written to these files less than PIPE_BUF (4k in Linux by default).

If you write lines larger than PIPE_BUF, logger creates another file with postfix _big (for example lsd_dir/category_name/202302121626_big.log) and flock(LOCK_EX) for writing.

Install

npm install nodejs-lsd-logger

Usage

Import writeLog or writeJson function from the library and use it to write data. Both functions return Promise and you can catch logging errors.

// import { writeLog } from 'nodejs-lsd-logger';
import { writeJson } from 'nodejs-lsd-logger';

writeJson('path/to/lsd_dir', {
    string: 'string',
    number: 123,
}).catch((error) => {
    console.error(error);
});
1.0.5

10 months ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago