0.2.6 • Published 6 years ago

hydra-plugin-hls v0.2.6

Weekly downloads
66
License
MIT
Repository
github
Last release
6 years ago

hydra-plugin-hls

Hydra Plugin for use with the Hydra Logging Service. This plugin adds a log function to hydra and overrides the hydraExpress.log call in order to send log messages to the Hydra Distributed Logging Service.

Service configuration entry

Configure this plugin by adding a plugins/hydraLogger branch to your hydra configuration. The logToConsole entry determines whether the logging is visible in the terminal window your service is running in. The onlyLogLocally entry determines whether log entries only appear locally and are not sent to the remote Hydra Logging Service. Ideally, both entries are set to true, but you may choose to only set onlyLogLocally to true, while you're debugging your service locally.

  "hydra": {
    "serviceName": "your-service",
    "serviceIP": "",
    "servicePort": 8080,
    "serviceType": "",
    "serviceDescription": "your service description",
    "plugins": {
      "hydraLogger": {
        "logToConsole": true,
        "onlyLogLocally": false
      }
    }
  }

Using the plugin in your service.

This plugin can be used with hydra or hydra-express. To use the plugin you only need to call the hydra or hydraExpress log method. The first param is a log type such as 'error', 'fatal', 'info', 'debug'. You can use a custom log type if you need to. The second param is either a string or an object.

hydra.log('error', 'Oh snap');
hydra.log('info', {
  name: 'Info object'
});

Configure for use with Hydra:

const hydra = require('hydra');
const HydraLogPlugin = require('hydra-plugin-hls/hydra');
hydra.use(new HydraLogPlugin);
:
:
: later
hydra.log('error', 'Oh snap!');

Configure for use with Hydra-Express:

const hydraExpress = require('hydra-express');
const HydraLogPlugin = require('hydra-plugin-hls/hydra-express');
hydraExpress.use(new HydraLogPlugin);
:
:
: later
hydraExpress.log('error', 'Oh snap!');
0.2.6

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.2

6 years ago

0.2.0

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago