JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 95
  • Score
    100M100P100Q39522F
  • License MIT

A lib that helps you log things with various prefix easily.

Package Exports

  • 3h-log

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (3h-log) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

3h-log

A lib that helps you log things with various prefix easily.

Install

$ npm install 3h-log

Example

const Logger = require('3h-log');

Logger.default.info('This is a piece of information logged by the default logger.');
// prints: [INFO] This is a piece of information logged by the default logger.

const logger = new Logger();

logger.warn('This is a warning with default prefix.');
// prints: [WARN] This is a warning with default prefix.

logger.prefix.warn = '[Wanring]';
logger.warn('This is a warning with my prefix.');
// prints: [Wanring] This is a warning with my prefix.

API

  • Logger(out?: stream.Writable) - The constructor of loggers.
    • default - An instance of Logger.
  • logger - ( Any instance of Logger. )
    • prefix - The prefixes.
      • info - The prefix for logger.info.
      • error - The prefix for logger.error.
      • warn - The prefix for logger.warn.
      • trace - The prefix for logger.trace.
    • info(msg: string) - To log some information.
    • error(msg: string) - To log some errors.
    • warn(msg: string) - To log some warnings.
    • trace(msg: string) - To log some traces.