Socket
Socket
Sign inDemoInstall

fwsp-logger

Package Overview
Dependencies
27
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fwsp-logger

Provides logging via pino, and transport to elasticsearch


Version published
Weekly downloads
19
decreased by-77.65%
Maintainers
1
Install size
390 kB
Created
Weekly downloads
 

Readme

Source

Logger Build Status

Synopsis

Provides a pino logger that ships its logs to Elasticsearch via pino-elasticsearch.

First, run npm install -g pino-elasticsearch

In Hydra Express service entry-point script:

if (config.logger) {
  const Logger = require('fwsp-logger'),
        logger = new Logger({
          name: config.logger.name || config.hydra.serviceName
        },
        config.logger.elasticsearch
      );
  hydraExpress.logger = logger;
  hydraExpress.appLogger = logger.getLogger();
}

with corresponding entry in config.json:

"logger": {
  "elasticsearch": {
    "host": "localhost",
    "port": 9200
  }
},

General usage:

const Logger = require('fwsp-logger'),
      logger = new Logger(
        { name: 'myApp' },
        { host: 'your.elasticsearch.host.com', port: 9200 }
    );
const appLogger = logger.getLogger();
appLogger.error('An error happened');
appLogger.info('Something else happened');

Testing

To make sure logs are getting shipped to Elasticsearch, you can spin up docker containers with ES and Kibana using the docker-compose.yml file in this repository.

You will need docker and docker-compose installed, then in this project folder, launch docker-compose up.

License

Licensed under MIT.

Keywords

FAQs

Last updated on 28 Nov 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc