mlcl_log
TypeScript icon, indicating that this package has built-in type declarations

0.9.6 • Public • Published

Build Status

NPM

NPM

NPM version

mlcl_log

The integrated logging mechanism is available via the global molecuel instance in every module.

When starting up. The default logging mechanism is to log to the console. After the elasticsearch instance has been connected the mlcl_log module changes the logging to the elastic. The log format is compatible with logstash format and it should be possible to analyse the data with Kibana.

Every module gets the molecule core module instance with it’s init function parameters.

To use the logging of the molecuel system it’s just needed to execute

molecuel.log.info(‘mymodulename’, ‘message’, {field1: ‘myfielddata’}) molecuel.log.warn(‘mymodulename’, ‘message’, {field1: ‘myfielddata’}) molecuel.log.error(‘mymodulename’, ‘message’, {field1: ‘myfielddata’}) molecuel.log.debug(‘mymodulename’, ‘message’, {field1: ‘myfielddata’})

On default every log level except the debug level will be logged to the elastic search instance except the debug level.

Debugging can be configured via the configuration.

ttl: '4w',
transports: {
  elasticsearch: {
   level: 'info'
  },
  console: {
   level: 'debug'
  }
}

In the config above the system logs everything to console. If the console entry in transports is removed only info debug level will be logged to elastic search. Console will be disabled.

If the elasticsearch transport entry will be changed to debug or something else there will be more log output to the elasticsearch.

/mlcl_log/

    Package Sidebar

    Install

    npm i mlcl_log

    Weekly Downloads

    10

    Version

    0.9.6

    License

    MIT

    Unpacked Size

    1.25 MB

    Total Files

    49

    Last publish

    Collaborators

    • alexanderknapstein
    • dominicboettger