1.0.5 • Published 2 years ago

@1xtr/moleculer-cloudwatch-logger v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Moleculer logo

NPM version NPM Downloads

Send logs to AWS CloudWatch

This is a fork from native Datadog logger

Description

Easy to send logs directly to AWS CloudWatch

Install

$ npm install @1xtr/moleculer-cloudwatch-logger --save

Import

// ES5 example
const CloudWatchLogger = require('@1xtr/moleculer-cloudwatch-logger');

// ES6+ example
import { CloudWatchLogger } from '@1xtr/moleculer-cloudwatch-logger';

Usage

module.exports = {
  logger: new CloudWatchLogger({
    // put here your options
  })
}

Default options

const defaultOptions = {
  clientOptions: {},
  source: process.env.MOL_NODE_NAME || 'moleculer',
  hostname: hostname(),
  objectPrinter: null,
  interval: 5 * 1000,
  excludeModules: [],
  logGroupName: `mol-${process.env.MOL_NODE_NAME || hostname()}`,
}

Options example

{
  "clientOptions": {
    "region": "us-east-1"
  },
  "excludeModules": [
    "broker",
    "registry",
    "discovery",
    "transporter",
    "$node",
    "transit",
    "cacher"
  ]
}