0.0.8 • Published 5 years ago

hlx-logger v0.0.8

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

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

NameTypeRequiredDefaultDescription
optionsobjectNo{}See below

options

NameTypeDefaultDescription
levelstring'simple'level should be either of 'simple', 'objDump', or 'raw'
outDirstringAll logs are output to process.stdoutoutDir should be a path to a directory in which log files are stored
omitTimebooleanfalseIf true, timestamps are not logged

return value

An instance of TransformStream.

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago