https://github.com/pnxtech/hydra-plugin-hls
Hydra Plugin for use with the Hydra Logging Service
https://github.com/pnxtech/hydra-plugin-hls
Last synced: 9 months ago
JSON representation
Hydra Plugin for use with the Hydra Logging Service
- Host: GitHub
- URL: https://github.com/pnxtech/hydra-plugin-hls
- Owner: pnxtech
- License: mit
- Created: 2018-03-13T23:30:10.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-26T18:03:23.000Z (almost 8 years ago)
- Last Synced: 2025-04-11T04:06:02.251Z (9 months ago)
- Language: JavaScript
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hydra-plugin-hls
Hydra Plugin for use with the [Hydra Logging Service](https://github.com/cjus/hydra-logging-svcs). 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:
```js
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:
```js
const hydraExpress = require('hydra-express');
const HydraLogPlugin = require('hydra-plugin-hls/hydra-express');
hydraExpress.use(new HydraLogPlugin);
:
:
: later
hydraExpress.log('error', 'Oh snap!');
```