Skip to content

Latest commit

 

History

History
57 lines (40 loc) · 1.47 KB

API.md

File metadata and controls

57 lines (40 loc) · 1.47 KB

API Reference

Instantiating

To get an instance of the logger, you simply require the function and call it, optionally passing it a logging instance to make use of:

const TokiLogger = require('toki-logger');
const logger = TokiLogger(myLoggingInstance);

If you require the logger multiple times, it'll return the same instance allowing you to preconfigure it ahead of time without having to pass it along.

Functions

The instance itself exposes the following functions:

  • error
  • warn
  • info
  • debug
  • trace

Each function accepts any arguments of any type and simple, blindly, passes them through.

Events

Observing

Toki-Logger will listen to the following events if it's asked to observe(someEventEmitter):

  • error
  • warn
  • info
  • debug
  • trace

Those events will be treated the same as if the matching method was called directly on Toki-Logger, passing along all arguments blindly.

Emitting

Toki logger will emit the following events when it's log methods are called:

  • log.error
  • log.warn
  • log.info
  • log.debug
  • log.trace