JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3022
  • Score
    100M100P100Q114279F
  • License Apache-2.0

Module to support the optimized delivery of web application resources

Package Exports

  • raptor-logging

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 (raptor-logging) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

raptor-logging

Super simple logging system that works on the server and and in the browser.

Example

projects/logging-test/run.js:

require('raptor-logging').configure({
    loggers: {
        'ROOT': 'WARN',
        'logging-test': 'DEBUG'
    }
});

// ...

var logger = require('raptor-logging').logger(module);
logger.debug('This is a debug message');

Output:

DEBUG logging-test/run: This is a debug message

You can also pass multiple arguments, as well as non-String arguments to the logging methods.

For example:

var logger = require('raptor-logging').logger(module);
logger.debug('This is a debug message', {foo: 'bar'});

Output:

DEBUG logging-test/run: This is a debug message { foo: 'bar' }

Installation

npm install raptor-logging --save

API

logger(module)

Returns a new Logger instance whose name is based on the filename associated with the Node.js module object.

Example:

var logger = require('raptor-logging').logger(module);
logger.debug('Hello World');

logger(name)

Returns a new Logger instance with the given name

Example:

var logger = require('raptor-logging').logger('foo');
logger.debug('Hello World');

Output:

DEBUG foo: Hello World

configure(options)

Supported options:

  • loggers: A mapping of logger prefixes to log levels (see below)
  • appenders: An array of appender instances (see ConsoleAppender for an example appender implementation)

Example:

require('raptor-logging').configure({
    'ROOT': 'WARN',
    'foo': 'DEBUG',
    'foo/bar': 'WARN',
});

Logger

Methods:

  • isTraceEnabled() : boolean
  • isDebugEnabled() : boolean
  • isInfoEnabled() : boolean
  • isWarnEnabled() : boolean
  • isErrorEnabled() : boolean
  • isFatalEnabled() : boolean
  • dump(arg1, arg2, ...)
  • trace(arg1, arg2, ...)
  • debug(arg1, arg2, ...)
  • info(arg1, arg2, ...)
  • warn(arg1, arg2, ...)
  • error(arg1, arg2, ...)
  • fatal(arg1, arg2, ...)

Contributors

Contribute

Pull Requests welcome. Please submit Github issues for any feature enhancements, bugs or documentation problems.

License

Apache License v2.0