0.5.0 • Published 6 years ago

yet-another-logger v0.5.0

Weekly downloads
34
License
MIT
Repository
github
Last release
6 years ago

Yet Another Logger

Installation

npm install --save yet-another-logger

Usage

Central logger file, lets call logger.js

const logManager = require('yet-another-logger');

const logglyConfig = {
  token: 'secret-token',
  subdomain: 'subdomain name'
};

global.l = logManager(logglyConfig).loggerFactory({ name: 'app' });

Some other file

process.env.NODE_ENV = 'test';

const _ = require('lodash');
const chai = require('chai');

const expect = chai.expect;

after(function(done) {
  this.timeout(20 * 1000);
  console.log(l.getWaiting()) // prints number of logs waiting for confirmation from loggly
  l.onAllLogsReceived(done);
});

describe('foo', function() {
  this.timeout(10 * 1000);
  describe('foo.search', function() {
    it('should work', async function() {
      let res;
      try { res = foo.search() } catch(e) { log.error(e); }
      l.info('foo.search', res);
    });
  });
});

Documentation

Classes

Functions

LogManager ⇐ EventEmitter

Kind: global class
Extends: EventEmitter
See

logManager.bunyanFactory(options, cb)

Creates a bunyan instance

Kind: instance method of LogManager

ParamTypeDefault
optionsObject{}
cbfunctionnoop

logManager.loggerFactory(options, cb)

Creates a logger instance

Kind: instance method of LogManager

ParamTypeDefault
optionsObject{}
cbfunction

logManagerFactory(logglyConfig, options)

Creates an instance of the LogManager class

Kind: global function
See: LogManager

ParamTypeDefault
logglyConfigObject
logglyConfig.tokenString
logglyConfig.subdomainString
optionsObject
options.logToStdoutInDevBooleantrue

Contributing

Updating docs

Docs are generated from JSDocs via npm run docs

0.5.0

6 years ago

0.4.5

6 years ago

0.4.4

6 years ago

0.4.3

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.3.0

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.12

7 years ago

0.1.11

7 years ago

0.1.10

7 years ago

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.1

7 years ago