3.1.6 • Published 2 years ago

@ambassify/bunyan-logger v3.1.6

Weekly downloads
29
License
MIT
Repository
github
Last release
2 years ago

bunyan-logger

A drop-in replacement logger for console which logs to graylog and the console. It includes support for CommonJS as well as ES Modules and has optimized builds for the browser. These are exposed through the various package.json entrypoints.

Usage

CommonJS

const createLogger = require('@ambassify/bunyan-logger');
const console = createLogger({ /* options */ });

// or to get a preconfigured logger based on your environment
const console = require('@ambassify/bunyan-logger/default');

console.log('test'); // Logs to console and graylog

ES Modules

import createLogger from '@ambassify/bunyan-logger';
const console = createLogger({ /* options */ });

// or to get a preconfigured logger based on your environment
import console from '@ambassify/bunyan-logger/default.esm';

console.log('test'); // Logs to console and graylog

Options

NameTypeDescription
nameStringName for your logger. Required.
notifyBooleanWhether or not to output a log when a stream is enabled. Defaults to true. Can be overridden per stream.
levelStringMinimal log level that gets emitted, lower levels are ignored. Can be overridden per stream.
fieldsObjectYou can pass default fields for the logger here, these will be included on every log record.
stdoutObjectOptions for the console logger. Set to false to disable.
serializersObjectBunyan serializers. The default serializers are always added.
logUnhandledBooleanWhether or not to log unhandled errors, promise rejections, window.onerror events, ... Defaults to false.
stdout.prettybooleanWhether or not to output pretty logs instead of raw JSON. Defaults to true.
stdout.levelStringMinimal log level that gets emitted, lower levels are ignored.
stdout.notifybooleanWhether or not to output a log when this stream is enabled. Defaults to true.
graylogObjectOptions for the GELF logger. Set to false to disable.
graylog.endpointstringGELF endpoint of the graylog instance. Required.
graylog.tagsArrayTags to add to your graylog logs.
graylog.levelStringMinimal log level that gets emitted, lower levels are ignored.
graylog.notifybooleanWhether or not to output a log when this stream is enabled. Defaults to true.
3.1.6

2 years ago

5.0.0

2 years ago

4.1.0

3 years ago

4.0.0

3 years ago

3.1.5

3 years ago

3.1.3

3 years ago

3.1.4

3 years ago

3.1.2

4 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.8

4 years ago

3.0.7

4 years ago

3.0.6

4 years ago

3.0.5

4 years ago

3.0.4

4 years ago

3.0.3

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.3.0-10

5 years ago

1.3.0-9

5 years ago

1.3.0-7

5 years ago

1.3.0-6

5 years ago

1.3.0-4

5 years ago

1.3.0-3

5 years ago

1.3.0-2

5 years ago

1.3.0-1

5 years ago

1.3.0-0

5 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.0.1

6 years ago

1.0.0

7 years ago