A module to simplify the connection to graylog

Methods

(static) init(graylogHostname, graylogPort, projectName, projectEnv)

Initialize the Connection with graylog.

Parameters:
NameTypeDescription
graylogHostnameString

Hostname of graylog server.

graylogPortNumber

Port of graylog server.

projectNameString

Name of current project working in.

projectEnv'local' | 'test' | 'staging' | 'production'

From what environment is this message sent from.

Since
  • 1.0.0
Author
  • Roel Voordendag
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:
NameTypeAttributesDescription
messageString

Message that will be displayed with the error in graylog.

severity'trace' | 'debug' | 'info' | 'warn' | 'error'

Show how big the severity is of the sending message.

shortMessageString<optional>

Short message that can be used as message. When not filled truncate original message. (50 characters max)

payloadObject<optional>

Extra payload that can be used to sent extra data.

Since
  • 1.0.0
Author
  • Roel Voordendag
Example
const graylog = require('@neobeach/modules-graylog');

graylog.send('There was an error that happened.', 'This is the error', 'error', {test: 123});