hlx-logger

0.0.8 • Public • Published

Build Status Coverage Status Dependency Status Development Dependency Status Known Vulnerabilities XO code style

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 all data events into a file or STDOUT
  • Timestamp is in UTC

Install

NPM

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.

Package Sidebar

Install

npm i hlx-logger

Weekly Downloads

8

Version

0.0.8

License

MIT

Unpacked Size

7.93 kB

Total Files

6

Last publish

Collaborators

  • kuu