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
.
- default - An instance of
- 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 - The prefix for
- 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.
- prefix - The prefixes.