1.0.12 • Published 3 years ago

logstash-http-logger v1.0.12

Weekly downloads
-
License
-
Repository
github
Last release
3 years ago

Logstash HTTP Logger

A simple logger with logstash integration using HTTP protocol.

Logger Levels

  • OFF: 0
  • FATAL: 1
  • ERROR: 2
  • WARN: 3
  • INFO: 4
  • DEBUG: 5
  • TRACE: 6
  • ALL: 7

--

Logger Level Visibility

LEVELFATALERRORWARNINFODEBUGTRACE
OFFxxxxxx
FATALxxxxx
ERRORxxxx
WARNxxx
INFOxx
DEBUGx
TRACE
ALL

--

Logger Configuration

{
  tags?: string[], // (optional)
  contextIdPropertyName?: string, // (optional) define your custom property name for context id
  defaultLayout?: Record<string, unknown> // (optional) define your custom log layout
}

--

How to Use?

import LogstashHttpLogger from 'logstash-http-logger';

const config = {
  tags: ['logger-dev']
};

const Logger = new LogstashHttpLogger('url-logstash-with-port', 7, config); // Logger instance with ALL (7) level

Logger.info('Testing logger');
Logger.trace({ data: { test: true } });
Logger.error(new Error('Testing error'));

// Using Logger with a RequestId

Logger.setContextId('1234');

// These 3 statements will log with requestId = 1234
Logger.info('Testing logger with requestId');
Logger.trace({ data: { test: false } });
Logger.error(new Error('Testing error with requestId'));
1.0.11

3 years ago

1.0.12

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.10

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago