0.0.8 • Published 5 years ago
hlx-logger v0.0.8
hlx-logger
A passthrough stream that skims all data and logs them into a file or stdout
Features
- Being used with other
hlx
objects, it provides a functionality to log alldata
events into a file or STDOUT - Timestamp is in UTC
Install
Usage
const hlx = require('hlx');
const {createLogger} = require('hlx-logger');
const logger = createLogger({
level: 'simple',
outDir: '/var/log/hls-events'
});
// Log all events into a file
hlx.src('http://example.com/master.m3u8')
.pipe(logger)
.pipe(hlx.dest())
.on('error', err => {
console.log(err.stack);
});
API
The features are built on top of the Node's transform streams.
createLogger(options)
Creates a new TransformStream
object.
params
Name | Type | Required | Default | Description |
---|---|---|---|---|
options | object | No | {} | See below |
options
Name | Type | Default | Description |
---|---|---|---|
level | string | 'simple' | level should be either of 'simple', 'objDump', or 'raw' |
outDir | string | All logs are output to process.stdout | outDir should be a path to a directory in which log files are stored |
omitTime | boolean | false | If true, timestamps are not logged |
return value
An instance of TransformStream
.