1.0.8 • Published 2 years ago

caip-fluentd-logger v1.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

caip-fluentd-logger (logging)

Motivation: this is the common module through which all logging related to analytics info will flow out of the Converse app. Required microservice will include this module as a dependency.

Fluentd

At time of this module creation, v3.2.0 was used.

Env Parameters

INDEX_NAME - required. The module will throw exception and fail if not present.

Example Use

const logger = require("caip-analytics-logger");
logger.emit('info', 'Info message with meta data', { someTag: 'tag for Kibana', otherTag: 'other data' });

Note: const var name we can use either logger or converseLogger

Log Levels

Winston uses industry standard levels. { emerg: 0, alert: 1, crit: 2, error: 3, warning: 4, notice: 5, info: 6, debug: 7 }

The default log level is info (except for !prod), but the implementing module can change it, but not recommended. (See winston docs.)

Recommended and Simple Log Level Strategy

  • error: for all flow paths which lead to exception, and halt module/application
  • warning: caught exception, but module can still proceed
  • info: capturing the journey of a request through the system, include metadata of IDs (session, conversation, userID, other)
  • debug: useful info meant only for developers

Rotation

Logs will have a daily rotate and maxSize as specified in the code.