A module to simplify the connection to graylog
- Source
Methods
(static) init(graylogHostname, graylogPort, projectName, projectEnv)
Initialize the Connection with graylog.
Parameters:
Name | Type | Description |
---|---|---|
graylogHostname | String | Hostname of graylog server. |
graylogPort | Number | Port of graylog server. |
projectName | String | Name of current project working in. |
projectEnv | 'local' | | From what environment is this message sent from. |
- Since
- 1.0.0
- Copyright
- MIT
- Source
Example
const {Runtime, Server} = require('@neobeach/core');
const graylog = require('@neobeach/modules-graylog');
Runtime(() => {
graylog.init('log.example.com', '12201', 'example-project-name', 'local');
});
(static) send(message, severity, shortMessageopt, payloadopt)
Function to send message to graylog.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
message | String | Message that will be displayed with the error in graylog. | |
severity | 'trace' | | Show how big the severity is of the sending message. | |
shortMessage | String | <optional> | Short message that can be used as message. When not filled truncate original message. (50 characters max) |
payload | Object | <optional> | Extra payload that can be used to sent extra data. |
- Since
- 1.0.0
- Copyright
- MIT
- Source
Example
const graylog = require('@neobeach/modules-graylog');
graylog.send('There was an error that happened.', 'This is the error', 'error', {test: 123});