1.1.3 • Published 6 years ago

logrx v1.1.3

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

logrx, a javascript logger built with rxjs

build status

Features:

  • mimic a subset of the Console API
  • support log level configuration
  • support having multiple logger implementation running in parallel
  • support multiple configurations
  • support multiple logging backend
  • provide an extensible API
  • leverage rxjs whenever possible
  • is lightweight

Getting Started

Using the global context, without customization.

const logger = getLogger('db');
logger.log('Hello World');

Configure a logger using its name.

import { configure, getLogger, Level } from 'logrx';
configure({
  name: 'api-call',
  appenders: ['console'],
  level: Level.ERROR
});
const logger = getLogger('api-call');
logger.error('Hello Error', new Error('some issue'));

Using a separate context:

import { configure, getLogger, Level, ROOT_LOGGER_NAME } from 'logrx';

export const context = new LoggerContext();

context.configure({
  name: ROOT_LOGGER_NAME,
  appenders: [],
  level: Level.OFF
}, {
  name: 'api-call',
  appenders: ['console'],
  level: Level.INFO
});

// ---- //

const logger = getLogger('db');
logger.log('SELECT', 'ID=', 5);

Contributing

This project is at a very early stage and will be open to contributions as soon as it proved to be an interesting library.

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.0.1

6 years ago