@1xtr/moleculer-cloudwatch-logger

1.0.5 • Public • Published

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"
  ]
}

Package Sidebar

Install

npm i @1xtr/moleculer-cloudwatch-logger

Weekly Downloads

5

Version

1.0.5

License

MIT

Unpacked Size

18.1 kB

Total Files

6

Last publish

Collaborators

  • 1xtr