1.8.0 • Published 25 days ago

@rplan/logger v1.8.0

Weekly downloads
352
License
MIT
Repository
-
Last release
25 days ago

Allex Responsible: R&D

Responsible: #Morpheus

rplan-logger

This is a reusable logger module for RPLAN. It's based on bunyan.

Configuration

The logger can be configured via the @rplan/config module which should be made available as a peer dependency to this logger module. The following config keys are recognized:

Required configuration

  • logging:root_logger_name (string) - The name of the root logger. This will be the common namespace prefix for all log entries which are created with this logger.

Optional configuration

  • LOG_LEVEL (string), defaults to info - Defines the log level upto which log entries will be written. See the bunyan docs for more information on available log levels.
  • logging:human_readable (boolean), defaults to false - A flag that indicates whether log entries should be formatted for human readability. Otherwise log entries will be pure JSON.

API

Default export

createLogger(namespace) - Creates a new logger instance with the given namespace.

Logger

The logger is derived from the bunyan logger. See the docs for the logging API.

Additional methods:

  • withNamespace(namespace) - Creates a child logger where the given namespace is appended to the namespace of the parent logger.

Example

import createLogger from '@rplan/logger'

const logger = createLogger('my-feature')
logger.info('My feature is started')

const subLogger = logger.withNamespace('my-sub-feature')
logger.debug('The sub logger is working')
1.8.0

25 days ago

1.7.0

1 month ago

1.6.1

3 months ago

1.6.0

7 months ago

1.5.0

1 year ago

1.3.7

2 years ago

1.3.6

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.2.1

4 years ago

1.1.0

6 years ago

1.0.0

6 years ago