pino
- Version 9.5.0
- Published
- 743 kB
- 11 dependencies
- MIT license
Install
npm i pino
yarn add pino
pnpm add pino
Overview
super fast, all natural json logger
Index
Variables
Functions
Interfaces
Type Aliases
Namespaces
P
- BaseLogger
- Bindings
- ChildLoggerOptions
- destination()
- DestinationStream
- DestinationStreamHasMetadata
- DestinationStreamWithMetadata
- Level
- LevelChangeEventListener
- LevelMapping
- LevelOrString
- levels
- LevelWithSilent
- LevelWithSilentOrString
- LogDescriptor
- LogEvent
- LogFn
- Logger
- LoggerOptions
- multistream()
- MultiStreamOptions
- MultiStreamRes
- SerializedError
- SerializedRequest
- SerializedResponse
- SerializerFn
- stdSerializers
- stdTimeFunctions
- StreamEntry
- symbols
- transport()
- TransportBaseOptions
- TransportMultiOptions
- TransportPipelineOptions
- TransportSingleOptions
- TransportTargetOptions
- version
- WriteFn
pino
- BaseLogger
- Bindings
- ChildLoggerOptions
- destination()
- DestinationStream
- DestinationStreamHasMetadata
- DestinationStreamWithMetadata
- Level
- LevelChangeEventListener
- LevelMapping
- LevelOrString
- levels
- LevelWithSilent
- LevelWithSilentOrString
- LogDescriptor
- LogEvent
- LogFn
- Logger
- LoggerOptions
- multistream()
- MultiStreamOptions
- MultiStreamRes
- SerializedError
- SerializedRequest
- SerializedResponse
- SerializerFn
- stdSerializers
- stdTimeFunctions
- StreamEntry
- symbols
- transport()
- TransportBaseOptions
- TransportMultiOptions
- TransportPipelineOptions
- TransportSingleOptions
- TransportTargetOptions
- version
- WriteFn
Variables
variable destination
const destination: (dest?: any) => SonicBoom;
variable levels
const levels: pino.LevelMapping;
variable multistream
const multistream: <TLevel = pino.Level>( streamsArray: | pino.DestinationStream | pino.StreamEntry<TLevel> | (pino.DestinationStream | pino.StreamEntry<TLevel>)[], opts?: pino.MultiStreamOptions) => pino.MultiStreamRes<TLevel>;
variable stdSerializers
const stdSerializers: any;
variable stdTimeFunctions
const stdTimeFunctions: { epochTime: TimeFn; unixTime: TimeFn; nullTime: TimeFn; isoTime: TimeFn;};
variable symbols
const symbols: { readonly setLevelSym: unique symbol; readonly getLevelSym: unique symbol; readonly levelValSym: unique symbol; readonly useLevelLabelsSym: unique symbol; readonly mixinSym: unique symbol; readonly lsCacheSym: unique symbol; readonly chindingsSym: unique symbol; readonly parsedChindingsSym: unique symbol; readonly asJsonSym: unique symbol; readonly writeSym: unique symbol; readonly serializersSym: unique symbol; readonly redactFmtSym: unique symbol; readonly timeSym: unique symbol; readonly timeSliceIndexSym: unique symbol; readonly streamSym: unique symbol; readonly stringifySym: unique symbol; readonly stringifySafeSym: unique symbol; readonly stringifiersSym: unique symbol; readonly endSym: unique symbol; readonly formatOptsSym: unique symbol; readonly messageKeySym: unique symbol; readonly errorKeySym: unique symbol; readonly nestedKeySym: unique symbol; readonly wildcardFirstSym: unique symbol; readonly needsMetadataGsym: unique symbol; readonly useOnlyCustomLevelsSym: unique symbol; readonly formattersSym: unique symbol; readonly hooksSym: unique symbol;};
variable transport
const transport: <TransportOptions = Record<string, any>>( options: | pino.TransportSingleOptions<TransportOptions> | pino.TransportMultiOptions<TransportOptions> | pino.TransportPipelineOptions<TransportOptions>) => any;
variable version
const version: string;
Functions
function P
P: typeof pino;
Parameter optionsOrStream
: an options object or a writable stream where the logs will be written. It can also receive some log-line metadata, if the relative protocol is enabled. Default: process.stdout
Returns
a new logger instance.
Parameter options
: an options object
Parameter stream
: a writable stream where the logs will be written. It can also receive some log-line metadata, if the relative protocol is enabled. Default: process.stdout
Returns
a new logger instance.
function pino
pino: typeof pino;
Parameter optionsOrStream
: an options object or a writable stream where the logs will be written. It can also receive some log-line metadata, if the relative protocol is enabled. Default: process.stdout
Returns
a new logger instance.
Parameter options
: an options object
Parameter stream
: a writable stream where the logs will be written. It can also receive some log-line metadata, if the relative protocol is enabled. Default: process.stdout
Returns
a new logger instance.
Interfaces
interface BaseLogger
interface BaseLogger extends pino.BaseLogger {}
interface ChildLoggerOptions
interface ChildLoggerOptions<CustomLevels extends string = never> extends pino.ChildLoggerOptions<CustomLevels> {}
interface DestinationStream
interface DestinationStream extends pino.DestinationStream {}
interface LevelMapping
interface LevelMapping extends pino.LevelMapping {}
interface LogEvent
interface LogEvent extends pino.LogEvent {}
interface LogFn
interface LogFn extends pino.LogFn {}
interface LoggerExtras
interface LoggerExtras< CustomLevels extends string = never, UseOnlyCustomLevels extends boolean = boolean> extends EventEmitter {}
property levels
levels: pino.LevelMapping;
property levelVal
levelVal: number;
Returns the integer value for the logger instance's logging level.
property onChild
onChild: OnChildCallback<CustomLevels>;
This can be used to modify the callback function on creation of a new child.
property useLevelLabels
useLevelLabels: boolean;
Outputs the level as a string instead of integer.
property version
readonly version: string;
Exposes the Pino package version. Also available on the exported pino function.
method addListener
addListener: ( event: 'level-change', listener: pino.LevelChangeEventListener<CustomLevels, UseOnlyCustomLevels>) => this;
method bindings
bindings: () => pino.Bindings;
Returns an object containing all the current bindings, cloned from the ones passed in via logger.child().
method child
child: <ChildCustomLevels extends string = never>( bindings: pino.Bindings, options?: ChildLoggerOptions<ChildCustomLevels>) => pino.Logger<CustomLevels | ChildCustomLevels>;
Creates a child logger, setting all key-value pairs in
bindings
as properties in the log lines. All serializers will be applied to the given pair. Child loggers use the same output stream as the parent and inherit the current log level of the parent at the time they are spawned. From v2.x.x the log level of a child is mutable (whereas in v1.x.x it was immutable), and can be set independently of the parent. If alevel
property is present in the object passed tochild
it will override the child logger level.Parameter bindings
: an object of key-value pairs to include in log lines as properties.
Parameter options
: an options object that will override child logger inherited options.
Returns
a child logger instance.
method flush
flush: (cb?: (err?: Error) => void) => void;
Flushes the content of the buffer when using pino.destination({ sync: false }). call the callback when finished
method isLevelEnabled
isLevelEnabled: (level: pino.LevelWithSilentOrString) => boolean;
A utility method for determining if a given log level will write to the destination.
method on
on: ( event: 'level-change', listener: pino.LevelChangeEventListener<CustomLevels, UseOnlyCustomLevels>) => this;
Registers a listener function that is triggered when the level is changed. Note: When browserified, this functionality will only be available if the
events
module has been required elsewhere (e.g. if you're using streams in the browser). This allows for a trade-off between bundle size and functionality.Parameter event
: only ever fires the
'level-change'
eventParameter listener
: The listener is passed four arguments:
levelLabel
,levelValue
,previousLevelLabel
,previousLevelValue
.
method once
once: ( event: 'level-change', listener: pino.LevelChangeEventListener<CustomLevels, UseOnlyCustomLevels>) => this;
method prependListener
prependListener: ( event: 'level-change', listener: pino.LevelChangeEventListener<CustomLevels, UseOnlyCustomLevels>) => this;
method prependOnceListener
prependOnceListener: ( event: 'level-change', listener: pino.LevelChangeEventListener<CustomLevels, UseOnlyCustomLevels>) => this;
method removeListener
removeListener: ( event: 'level-change', listener: pino.LevelChangeEventListener<CustomLevels, UseOnlyCustomLevels>) => this;
method setBindings
setBindings: (bindings: pino.Bindings) => void;
Adds to the bindings of this logger instance. Note: Does not overwrite bindings. Can potentially result in duplicate keys in log lines.
Parameter bindings
: an object of key-value pairs to include in log lines as properties.
interface LoggerOptions
interface LoggerOptions< CustomLevels extends string = never, UseOnlyCustomLevels extends boolean = boolean> extends pino.LoggerOptions<CustomLevels, UseOnlyCustomLevels> {}
interface MultiStreamOptions
interface MultiStreamOptions extends pino.MultiStreamOptions {}
interface MultiStreamRes
interface MultiStreamRes<TLevel = Level> extends pino.MultiStreamRes<TLevel> {}
interface redactOptions
interface redactOptions {}
interface StreamEntry
interface StreamEntry<TLevel = Level> extends pino.StreamEntry<TLevel> {}
interface TransportBaseOptions
interface TransportBaseOptions extends pino.TransportBaseOptions {}
interface TransportMultiOptions
interface TransportMultiOptions extends pino.TransportMultiOptions {}
interface TransportPipelineOptions
interface TransportPipelineOptions extends pino.TransportPipelineOptions {}
interface TransportSingleOptions
interface TransportSingleOptions extends pino.TransportSingleOptions {}
interface TransportTargetOptions
interface TransportTargetOptions extends pino.TransportTargetOptions {}
Type Aliases
type Bindings
type Bindings = pino.Bindings;
type DestinationStreamWithMetadata
type DestinationStreamWithMetadata = pino.DestinationStreamWithMetadata;
type Level
type Level = pino.Level;
type LevelChangeEventListener
type LevelChangeEventListener<CustomLevels extends string> = pino.LevelChangeEventListener<CustomLevels>;
type LevelOrString
type LevelOrString = pino.LevelOrString;
type LevelWithSilent
type LevelWithSilent = pino.LevelWithSilent;
type LevelWithSilentOrString
type LevelWithSilentOrString = pino.LevelWithSilentOrString;
type LogDescriptor
type LogDescriptor = pino.LogDescriptor;
type Logger
type Logger< CustomLevels extends string = never, UseOnlyCustomLevels extends boolean = boolean> = pino.Logger<CustomLevels, UseOnlyCustomLevels>;
type SerializedError
type SerializedError = pino.SerializedError;
type SerializedRequest
type SerializedRequest = pino.SerializedRequest;
type SerializedResponse
type SerializedResponse = pino.SerializedResponse;
type SerializerFn
type SerializerFn = pino.SerializerFn;
type WriteFn
type WriteFn = pino.WriteFn;
Namespaces
namespace P
namespace P {}
variable levels
const levels: LevelMapping;
Holds the current log format version (as output in the v property of each log record).
variable stdSerializers
const stdSerializers: any;
Provides functions for serializing objects common to many projects.
variable stdTimeFunctions
const stdTimeFunctions: { epochTime: TimeFn; unixTime: TimeFn; nullTime: TimeFn; isoTime: TimeFn;};
Provides functions for generating the timestamp property in the log output. You can set the
timestamp
option during initialization to one of these functions to adjust the output format. Alternatively, you can specify your own time function. A time function must synchronously return a string that would be a valid component of a JSON string. For example, the default function returns a string like,"time":1493426328206
.
variable symbols
const symbols: { readonly setLevelSym: unique symbol; readonly getLevelSym: unique symbol; readonly levelValSym: unique symbol; readonly useLevelLabelsSym: unique symbol; readonly mixinSym: unique symbol; readonly lsCacheSym: unique symbol; readonly chindingsSym: unique symbol; readonly parsedChindingsSym: unique symbol; readonly asJsonSym: unique symbol; readonly writeSym: unique symbol; readonly serializersSym: unique symbol; readonly redactFmtSym: unique symbol; readonly timeSym: unique symbol; readonly timeSliceIndexSym: unique symbol; readonly streamSym: unique symbol; readonly stringifySym: unique symbol; readonly stringifySafeSym: unique symbol; readonly stringifiersSym: unique symbol; readonly endSym: unique symbol; readonly formatOptsSym: unique symbol; readonly messageKeySym: unique symbol; readonly errorKeySym: unique symbol; readonly nestedKeySym: unique symbol; readonly wildcardFirstSym: unique symbol; readonly needsMetadataGsym: unique symbol; readonly useOnlyCustomLevelsSym: unique symbol; readonly formattersSym: unique symbol; readonly hooksSym: unique symbol;};
variable version
const version: string;
Exposes the Pino package version. Also available on the logger instance.
function destination
destination: ( dest?: | number | object | string | DestinationStream | NodeJS.WritableStream | SonicBoomOpts) => SonicBoom;
Create a Pino Destination instance: a stream-like object with significantly more throughput (over 30%) than a standard Node.js stream.
Parameter dest
: The
destination
parameter, can be a file descriptor, a file path, or an object withdest
property pointing to a fd or path. An ordinary Node.jsstream
file descriptor can be passed as the destination (such as the result offs.createWriteStream
) but for peak log writing performance, it is strongly recommended to usepino.destination
to create the destination stream.Returns
A Sonic-Boom stream to be used as destination for the pino function
function multistream
multistream: <TLevel = Level>( streamsArray: | (DestinationStream | StreamEntry<TLevel>)[] | DestinationStream | StreamEntry<TLevel>, opts?: MultiStreamOptions) => MultiStreamRes<TLevel>;
function transport
transport: <TransportOptions = Record<string, any>>( options: | TransportSingleOptions<TransportOptions> | TransportMultiOptions<TransportOptions> | TransportPipelineOptions<TransportOptions>) => ThreadStream;
interface BaseLogger
interface BaseLogger {}
property debug
debug: pino.LogFn;
Log at
'debug'
level the given msg. If the first argument is an object, all its properties will be included in the JSON line. If more args followsmsg
, these will be used to formatmsg
usingutil.format
.Parameter obj
: object to be serialized
Parameter msg
: the log message to write
Parameter
...args: format string values when
msg
is a format string
property error
error: pino.LogFn;
Log at
'error'
level the given msg. If the first argument is an object, all its properties will be included in the JSON line. If more args followsmsg
, these will be used to formatmsg
usingutil.format
.Parameter obj
: object to be serialized
Parameter msg
: the log message to write
Parameter
...args: format string values when
msg
is a format string
property fatal
fatal: pino.LogFn;
Log at
'fatal'
level the given msg. If the first argument is an object, all its properties will be included in the JSON line. If more args followsmsg
, these will be used to formatmsg
usingutil.format
.Parameter obj
: object to be serialized
Parameter msg
: the log message to write
Parameter
...args: format string values when
msg
is a format string
property info
info: pino.LogFn;
Log at
'info'
level the given msg. If the first argument is an object, all its properties will be included in the JSON line. If more args followsmsg
, these will be used to formatmsg
usingutil.format
.Parameter obj
: object to be serialized
Parameter msg
: the log message to write
Parameter
...args: format string values when
msg
is a format string
property level
level: pino.LevelWithSilentOrString;
Set this property to the desired logging level. In order of priority, available levels are:
- 'fatal' - 'error' - 'warn' - 'info' - 'debug' - 'trace'
The logging level is a __minimum__ level. For instance if
logger.level
is'info'
then all'fatal'
,'error'
,'warn'
, and'info'
logs will be enabled.You can pass
'silent'
to disable logging.
property silent
silent: pino.LogFn;
Noop function.
property trace
trace: pino.LogFn;
Log at
'trace'
level the given msg. If the first argument is an object, all its properties will be included in the JSON line. If more args followsmsg
, these will be used to formatmsg
usingutil.format
.Parameter obj
: object to be serialized
Parameter msg
: the log message to write
Parameter
...args: format string values when
msg
is a format string
property warn
warn: pino.LogFn;
Log at
'warn'
level the given msg. If the first argument is an object, all its properties will be included in the JSON line. If more args followsmsg
, these will be used to formatmsg
usingutil.format
.Parameter obj
: object to be serialized
Parameter msg
: the log message to write
Parameter
...args: format string values when
msg
is a format string
interface ChildLoggerOptions
interface ChildLoggerOptions<CustomLevels extends string = never> {}
property customLevels
customLevels?: { [level in CustomLevels]: number };
property formatters
formatters?: { level?: (label: string, number: number) => object; bindings?: (bindings: Bindings) => object; log?: (object: object) => object;};
property level
level?: LevelOrString;
property msgPrefix
msgPrefix?: string;
property redact
redact?: string[] | redactOptions;
property serializers
serializers?: { [key: string]: SerializerFn };
interface DestinationStream
interface DestinationStream {}
method write
write: (msg: string) => void;
interface DestinationStreamHasMetadata
interface DestinationStreamHasMetadata {}
property [symbols.needsMetadataGsym]
[symbols.needsMetadataGsym]: true;
property lastLevel
lastLevel: number;
property lastLogger
lastLogger: pino.Logger;
property lastMsg
lastMsg: string;
property lastObj
lastObj: object;
property lastTime
lastTime: string;
interface LevelMapping
interface LevelMapping {}
interface LogEvent
interface LogEvent {}
A data structure representing a log message, it represents the arguments passed to a logger statement, the level at which they were logged and the hierarchy of child bindings.
By default serializers are not applied to log output in the browser, but they will always be applied to
messages
andbindings
in thelogEvent
object. This allows us to ensure a consistent format for all values between server and client.
property bindings
bindings: Bindings[];
Represents each child logger (if any), and the relevant bindings.
For instance, given
logger.child({a: 1}).child({b: 2}).info({c: 3})
, the bindings array would hold[{a: 1}, {b: 2}]
and themessages
array would be[{c: 3}]
. Thebindings
are ordered according to their position in the child logger hierarchy, with the lowest index being the top of the hierarchy.
property level
level: { label: string; value: number;};
Holds the
label
(for instanceinfo
), and the corresponding numericalvalue
(for instance30
). This could be important in cases where client side level values and labels differ from server side.
property messages
messages: any[];
All arguments passed to logger method, (for instance
logger.info('a', 'b', 'c')
would result inmessages
array['a', 'b', 'c']
).
property ts
ts: number;
Unix epoch timestamp in milliseconds, the time is taken from the moment the logger method is called.
interface LogFn
interface LogFn {}
call signature
<T extends object>(obj: T, msg?: string, ...args: any[]): void;
call signature
(obj: unknown, msg?: string, ...args: any[]): void;
call signature
(msg: string, ...args: any[]): void;
interface LoggerOptions
interface LoggerOptions< CustomLevels extends string = never, UseOnlyCustomLevels extends boolean = boolean> {}
property base
base?: { [key: string]: any } | null;
key-value object added as child logger to each log line. If set to null the base child logger is not added
property browser
browser?: { /** * The `asObject` option will create a pino-like log object instead of passing all arguments to a console * method. When `write` is set, `asObject` will always be true. * * @example * pino.info('hi') // creates and logs {msg: 'hi', level: 30, time: <ts>} */ asObject?: boolean; formatters?: { /** * Changes the shape of the log level. * The default shape is { level: number }. */ level?: (label: string, number: number) => object; /** * Changes the shape of the log object. */ log?: (object: Record<string, unknown>) => Record<string, unknown>; }; /** * Instead of passing log messages to `console.log` they can be passed to a supplied function. If `write` is * set to a single function, all logging objects are passed to this function. If `write` is an object, it * can have methods that correspond to the levels. When a message is logged at a given level, the * corresponding method is called. If a method isn't present, the logging falls back to using the `console`. * * @example * const pino = require('pino')({ * browser: { * write: (o) => { * // do something with o * } * } * }) * * @example * const pino = require('pino')({ * browser: { * write: { * info: function (o) { * //process info log object * }, * error: function (o) { * //process error log object * } * } * } * }) */ write?: | WriteFn | ({ fatal?: WriteFn; error?: WriteFn; warn?: WriteFn; info?: WriteFn; debug?: WriteFn; trace?: WriteFn; } & { [logLevel: string]: WriteFn });
/** * The serializers provided to `pino` are ignored by default in the browser, including the standard * serializers provided with Pino. Since the default destination for log messages is the console, values * such as `Error` objects are enhanced for inspection, which they otherwise wouldn't be if the Error * serializer was enabled. We can turn all serializers on or we can selectively enable them via an array. * * When `serialize` is `true` the standard error serializer is also enabled (see * {@link https://github.com/pinojs/pino/blob/master/docs/api.md#pino-stdserializers}). This is a global * serializer which will apply to any `Error` objects passed to the logger methods. * * If `serialize` is an array the standard error serializer is also automatically enabled, it can be * explicitly disabled by including a string in the serialize array: `!stdSerializers.err` (see example). * * The `serialize` array also applies to any child logger serializers (see * {@link https://github.com/pinojs/pino/blob/master/docs/api.md#bindingsserializers-object} for how to * set child-bound serializers). * * Unlike server pino the serializers apply to every object passed to the logger method, if the `asObject` * option is `true`, this results in the serializers applying to the first object (as in server pino). * * For more info on serializers see * {@link https://github.com/pinojs/pino/blob/master/docs/api.md#serializers-object}. * * @example * const pino = require('pino')({ * browser: { * serialize: true * } * }) * * @example * const pino = require('pino')({ * serializers: { * custom: myCustomSerializer, * another: anotherSerializer * }, * browser: { * serialize: ['custom'] * } * }) * // following will apply myCustomSerializer to the custom property, * // but will not apply anotherSerializer to another key * pino.info({custom: 'a', another: 'b'}) * * @example * const pino = require('pino')({ * serializers: { * custom: myCustomSerializer, * another: anotherSerializer * }, * browser: { * serialize: ['!stdSerializers.err', 'custom'] //will not serialize Errors, will serialize `custom` keys * } * }) */ serialize?: boolean | string[];
/** * Options for transmission of logs. * * @example * const pino = require('pino')({ * browser: { * transmit: { * level: 'warn', * send: function (level, logEvent) { * if (level === 'warn') { * // maybe send the logEvent to a separate endpoint * // or maybe analyse the messages further before sending * } * // we could also use the `logEvent.level.value` property to determine * // numerical value * if (logEvent.level.value >= 50) { // covers error and fatal * * // send the logEvent somewhere * } * } * } * } * }) */ transmit?: { /** * Specifies the minimum level (inclusive) of when the `send` function should be called, if not supplied * the `send` function will be called based on the main logging `level` (set via `options.level`, * defaulting to `info`). */ level?: LevelOrString; /** * Remotely record log messages. * * @description Called after writing the log message. */ send: (level: Level, logEvent: LogEvent) => void; }; /** * The disabled option will disable logging in browser if set to true, by default it is set to false. * * @example * const pino = require('pino')({browser: {disabled: true}}) */ disabled?: boolean;};
Browser only, see http://getpino.io/#/docs/browser.
property crlf
crlf?: boolean;
logs newline delimited JSON with
\r\n
instead of\n
. Default:false
.
property customLevels
customLevels?: { [level in CustomLevels]: number };
Use this option to define additional logging levels. The keys of the object correspond the namespace of the log level, and the values should be the numerical value of the level.
property depthLimit
depthLimit?: number;
Stringification limit at a specific nesting depth when logging circular object. Default:
5
.
property edgeLimit
edgeLimit?: number;
Stringification limit of properties/elements when logging a specific object/array with circular references. Default:
100
.
property enabled
enabled?: boolean;
Enables logging. Default:
true
.
property errorKey
errorKey?: string;
The string key for the 'error' in the JSON object. Default: "err".
property formatters
formatters?: { /** * Changes the shape of the log level. * The default shape is { level: number }. * The function takes two arguments, the label of the level (e.g. 'info') and the numeric value (e.g. 30). */ level?: (label: string, number: number) => object; /** * Changes the shape of the bindings. * The default shape is { pid, hostname }. * The function takes a single argument, the bindings object. * It will be called every time a child logger is created. */ bindings?: (bindings: Bindings) => object; /** * Changes the shape of the log object. * This function will be called every time one of the log methods (such as .info) is called. * All arguments passed to the log method, except the message, will be pass to this function. * By default it does not change the shape of the log object. */ log?: (object: Record<string, unknown>) => Record<string, unknown>;};
An object containing functions for formatting the shape of the log lines. These functions should return a JSONifiable object and should never throw. These functions allow for full customization of the resulting log lines. For example, they can be used to change the level key name or to enrich the default metadata.
property hooks
hooks?: { /** * Allows for manipulating the parameters passed to logger methods. The signature for this hook is * logMethod (args, method, level) {}, where args is an array of the arguments that were passed to the * log method and method is the log method itself, and level is the log level. This hook must invoke the method function by * using apply, like so: method.apply(this, newArgumentsArray). */ logMethod?: ( this: Logger, args: Parameters<LogFn>, method: LogFn, level: number ) => void;};
An object mapping to hook functions. Hook functions allow for customizing internal logger operations. Hook functions must be synchronous functions.
property level
level?: LevelWithSilentOrString;
One of the supported levels or
silent
to disable logging. Any other value defines a custom level and requires supplying a level value vialevelVal
. Default: 'info'.
property levelComparison
levelComparison?: | 'ASC' | 'DESC' | ((current: number, expected: number) => boolean);
Use this option to define custom comparison of log levels. Useful to compare custom log levels or non-standard level values. Default: "ASC"
property levelVal
levelVal?: number;
When defining a custom log level via level, set to an integer value to define the new level. Default:
undefined
.
property messageKey
messageKey?: string;
The string key for the 'message' in the JSON object. Default: "msg".
property mixin
mixin?: MixinFn<CustomLevels>;
If provided, the
mixin
function is called each time one of the active logging methods is called. The function must synchronously return an object. The properties of the returned object will be added to the logged JSON.
property mixinMergeStrategy
mixinMergeStrategy?: MixinMergeStrategyFn;
If provided, the
mixinMergeStrategy
function is called each time one of the active logging methods is called. The first parameter is the valuemergeObject
or an empty object, the second parameter is the value resulting frommixin()
or an empty object. The function must synchronously return an object.
property msgPrefix
msgPrefix?: string;
A string that would be prefixed to every message (and child message)
property name
name?: string;
The name of the logger. Default:
undefined
.
property nestedKey
nestedKey?: string;
The string key to place any logged object under.
property onChild
onChild?: OnChildCallback<CustomLevels>;
Optional child creation callback.
property redact
redact?: string[] | redactOptions;
As an array, the redact option specifies paths that should have their values redacted from any log output.
Each path must be a string using a syntax which corresponds to JavaScript dot and bracket notation.
If an object is supplied, three options can be specified:
paths (String[]): Required. An array of paths censor (String): Optional. A value to overwrite key which are to be redacted. Default: '[Redacted]' remove (Boolean): Optional. Instead of censoring the value, remove both the key and the value. Default: false
property safe
safe?: boolean;
Avoid error causes by circular references in the object tree. Default:
true
.
property serializers
serializers?: { [key: string]: SerializerFn };
an object containing functions for custom serialization of objects. These functions should return an JSONifiable object and they should never throw. When logging an object, each top-level property matching the exact key of a serializer will be serialized using the defined serializer.
property timestamp
timestamp?: TimeFn | boolean;
Enables or disables the inclusion of a timestamp in the log message. If a function is supplied, it must synchronously return a JSON string representation of the time. If set to
false
, no timestamp will be included in the output. See stdTimeFunctions for a set of available functions for passing in as a value for this option. Caution: any sort of formatted time will significantly slow down Pino's performance.
property transport
transport?: | TransportSingleOptions | TransportMultiOptions | TransportPipelineOptions;
property useOnlyCustomLevels
useOnlyCustomLevels?: UseOnlyCustomLevels;
Use this option to only use defined
customLevels
and omit Pino's levels. Logger's defaultlevel
must be changed to a value incustomLevels
in order to useuseOnlyCustomLevels
Warning: this option may not be supported by downstream transports.
interface MultiStreamOptions
interface MultiStreamOptions {}
interface MultiStreamRes
interface MultiStreamRes<TOriginLevel = Level> {}
property add
add: <TLevel = Level>( dest: StreamEntry<TLevel> | DestinationStream) => MultiStreamRes<TOriginLevel & TLevel>;
property flushSync
flushSync: () => void;
property minLevel
minLevel: number;
property streams
streams: StreamEntry<TOriginLevel>[];
property write
write: (data: any) => void;
method clone
clone: <TLevel = Level>(level: TLevel) => MultiStreamRes<TLevel>;
interface StreamEntry
interface StreamEntry<TLevel = Level> {}
interface TransportBaseOptions
interface TransportBaseOptions<TransportOptions = Record<string, any>> {}
interface TransportMultiOptions
interface TransportMultiOptions<TransportOptions = Record<string, any>> extends TransportBaseOptions<TransportOptions> {}
interface TransportPipelineOptions
interface TransportPipelineOptions<TransportOptions = Record<string, any>> extends TransportBaseOptions<TransportOptions> {}
interface TransportSingleOptions
interface TransportSingleOptions<TransportOptions = Record<string, any>> extends TransportBaseOptions<TransportOptions> {}
property target
target: string;
interface TransportTargetOptions
interface TransportTargetOptions<TransportOptions = Record<string, any>> {}
type Bindings
type Bindings = Record<string, any>;
type DestinationStreamWithMetadata
type DestinationStreamWithMetadata = DestinationStream & ({ [symbols.needsMetadataGsym]?: false } | DestinationStreamHasMetadata);
type Level
type Level = 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace';
type LevelChangeEventListener
type LevelChangeEventListener< CustomLevels extends string = never, UseOnlyCustomLevels extends boolean = boolean> = ( lvl: LevelWithSilentOrString, val: number, prevLvl: LevelWithSilentOrString, prevVal: number, logger: Logger<CustomLevels, UseOnlyCustomLevels>) => void;
type LevelOrString
type LevelOrString = Level | (string & {});
type LevelWithSilent
type LevelWithSilent = pino.Level | 'silent';
type LevelWithSilentOrString
type LevelWithSilentOrString = LevelWithSilent | (string & {});
type LogDescriptor
type LogDescriptor = Record<string, any>;
type Logger
type Logger< CustomLevels extends string = never, UseOnlyCustomLevels extends boolean = boolean> = BaseLogger & LoggerExtras<CustomLevels> & CustomLevelLogger<CustomLevels, UseOnlyCustomLevels>;
type SerializedError
type SerializedError = pinoStdSerializers.SerializedError;
type SerializedRequest
type SerializedRequest = pinoStdSerializers.SerializedRequest;
type SerializedResponse
type SerializedResponse = pinoStdSerializers.SerializedResponse;
type SerializerFn
type SerializerFn = (value: any) => any;
type WriteFn
type WriteFn = (o: object) => void;
namespace pino
namespace pino {}
variable levels
const levels: LevelMapping;
Holds the current log format version (as output in the v property of each log record).
variable stdSerializers
const stdSerializers: any;
Provides functions for serializing objects common to many projects.
variable stdTimeFunctions
const stdTimeFunctions: { epochTime: TimeFn; unixTime: TimeFn; nullTime: TimeFn; isoTime: TimeFn;};
Provides functions for generating the timestamp property in the log output. You can set the
timestamp
option during initialization to one of these functions to adjust the output format. Alternatively, you can specify your own time function. A time function must synchronously return a string that would be a valid component of a JSON string. For example, the default function returns a string like,"time":1493426328206
.
variable symbols
const symbols: { readonly setLevelSym: unique symbol; readonly getLevelSym: unique symbol; readonly levelValSym: unique symbol; readonly useLevelLabelsSym: unique symbol; readonly mixinSym: unique symbol; readonly lsCacheSym: unique symbol; readonly chindingsSym: unique symbol; readonly parsedChindingsSym: unique symbol; readonly asJsonSym: unique symbol; readonly writeSym: unique symbol; readonly serializersSym: unique symbol; readonly redactFmtSym: unique symbol; readonly timeSym: unique symbol; readonly timeSliceIndexSym: unique symbol; readonly streamSym: unique symbol; readonly stringifySym: unique symbol; readonly stringifySafeSym: unique symbol; readonly stringifiersSym: unique symbol; readonly endSym: unique symbol; readonly formatOptsSym: unique symbol; readonly messageKeySym: unique symbol; readonly errorKeySym: unique symbol; readonly nestedKeySym: unique symbol; readonly wildcardFirstSym: unique symbol; readonly needsMetadataGsym: unique symbol; readonly useOnlyCustomLevelsSym: unique symbol; readonly formattersSym: unique symbol; readonly hooksSym: unique symbol;};
variable version
const version: string;
Exposes the Pino package version. Also available on the logger instance.
function destination
destination: ( dest?: | number | object | string | DestinationStream | NodeJS.WritableStream | SonicBoomOpts) => SonicBoom;
Create a Pino Destination instance: a stream-like object with significantly more throughput (over 30%) than a standard Node.js stream.
Parameter dest
: The
destination
parameter, can be a file descriptor, a file path, or an object withdest
property pointing to a fd or path. An ordinary Node.jsstream
file descriptor can be passed as the destination (such as the result offs.createWriteStream
) but for peak log writing performance, it is strongly recommended to usepino.destination
to create the destination stream.Returns
A Sonic-Boom stream to be used as destination for the pino function
function multistream
multistream: <TLevel = Level>( streamsArray: | (DestinationStream | StreamEntry<TLevel>)[] | DestinationStream | StreamEntry<TLevel>, opts?: MultiStreamOptions) => MultiStreamRes<TLevel>;
function transport
transport: <TransportOptions = Record<string, any>>( options: | TransportSingleOptions<TransportOptions> | TransportMultiOptions<TransportOptions> | TransportPipelineOptions<TransportOptions>) => ThreadStream;
interface BaseLogger
interface BaseLogger {}
property debug
debug: pino.LogFn;
Log at
'debug'
level the given msg. If the first argument is an object, all its properties will be included in the JSON line. If more args followsmsg
, these will be used to formatmsg
usingutil.format
.Parameter obj
: object to be serialized
Parameter msg
: the log message to write
Parameter
...args: format string values when
msg
is a format string
property error
error: pino.LogFn;
Log at
'error'
level the given msg. If the first argument is an object, all its properties will be included in the JSON line. If more args followsmsg
, these will be used to formatmsg
usingutil.format
.Parameter obj
: object to be serialized
Parameter msg
: the log message to write
Parameter
...args: format string values when
msg
is a format string
property fatal
fatal: pino.LogFn;
Log at
'fatal'
level the given msg. If the first argument is an object, all its properties will be included in the JSON line. If more args followsmsg
, these will be used to formatmsg
usingutil.format
.Parameter obj
: object to be serialized
Parameter msg
: the log message to write
Parameter
...args: format string values when
msg
is a format string
property info
info: pino.LogFn;
Log at
'info'
level the given msg. If the first argument is an object, all its properties will be included in the JSON line. If more args followsmsg
, these will be used to formatmsg
usingutil.format
.Parameter obj
: object to be serialized
Parameter msg
: the log message to write
Parameter
...args: format string values when
msg
is a format string
property level
level: pino.LevelWithSilentOrString;
Set this property to the desired logging level. In order of priority, available levels are:
- 'fatal' - 'error' - 'warn' - 'info' - 'debug' - 'trace'
The logging level is a __minimum__ level. For instance if
logger.level
is'info'
then all'fatal'
,'error'
,'warn'
, and'info'
logs will be enabled.You can pass
'silent'
to disable logging.
property silent
silent: pino.LogFn;
Noop function.
property trace
trace: pino.LogFn;
Log at
'trace'
level the given msg. If the first argument is an object, all its properties will be included in the JSON line. If more args followsmsg
, these will be used to formatmsg
usingutil.format
.Parameter obj
: object to be serialized
Parameter msg
: the log message to write
Parameter
...args: format string values when
msg
is a format string
property warn
warn: pino.LogFn;
Log at
'warn'
level the given msg. If the first argument is an object, all its properties will be included in the JSON line. If more args followsmsg
, these will be used to formatmsg
usingutil.format
.Parameter obj
: object to be serialized
Parameter msg
: the log message to write
Parameter
...args: format string values when
msg
is a format string
interface ChildLoggerOptions
interface ChildLoggerOptions<CustomLevels extends string = never> {}
property customLevels
customLevels?: { [level in CustomLevels]: number };
property formatters
formatters?: { level?: (label: string, number: number) => object; bindings?: (bindings: Bindings) => object; log?: (object: object) => object;};
property level
level?: LevelOrString;
property msgPrefix
msgPrefix?: string;
property redact
redact?: string[] | redactOptions;
property serializers
serializers?: { [key: string]: SerializerFn };
interface DestinationStream
interface DestinationStream {}
method write
write: (msg: string) => void;
interface DestinationStreamHasMetadata
interface DestinationStreamHasMetadata {}
property [symbols.needsMetadataGsym]
[symbols.needsMetadataGsym]: true;
property lastLevel
lastLevel: number;
property lastLogger
lastLogger: pino.Logger;
property lastMsg
lastMsg: string;
property lastObj
lastObj: object;
property lastTime
lastTime: string;
interface LevelMapping
interface LevelMapping {}
interface LogEvent
interface LogEvent {}
A data structure representing a log message, it represents the arguments passed to a logger statement, the level at which they were logged and the hierarchy of child bindings.
By default serializers are not applied to log output in the browser, but they will always be applied to
messages
andbindings
in thelogEvent
object. This allows us to ensure a consistent format for all values between server and client.
property bindings
bindings: Bindings[];
Represents each child logger (if any), and the relevant bindings.
For instance, given
logger.child({a: 1}).child({b: 2}).info({c: 3})
, the bindings array would hold[{a: 1}, {b: 2}]
and themessages
array would be[{c: 3}]
. Thebindings
are ordered according to their position in the child logger hierarchy, with the lowest index being the top of the hierarchy.
property level
level: { label: string; value: number;};
Holds the
label
(for instanceinfo
), and the corresponding numericalvalue
(for instance30
). This could be important in cases where client side level values and labels differ from server side.
property messages
messages: any[];
All arguments passed to logger method, (for instance
logger.info('a', 'b', 'c')
would result inmessages
array['a', 'b', 'c']
).
property ts
ts: number;
Unix epoch timestamp in milliseconds, the time is taken from the moment the logger method is called.
interface LogFn
interface LogFn {}
call signature
<T extends object>(obj: T, msg?: string, ...args: any[]): void;
call signature
(obj: unknown, msg?: string, ...args: any[]): void;
call signature
(msg: string, ...args: any[]): void;
interface LoggerOptions
interface LoggerOptions< CustomLevels extends string = never, UseOnlyCustomLevels extends boolean = boolean> {}
property base
base?: { [key: string]: any } | null;
key-value object added as child logger to each log line. If set to null the base child logger is not added
property browser
browser?: { /** * The `asObject` option will create a pino-like log object instead of passing all arguments to a console * method. When `write` is set, `asObject` will always be true. * * @example * pino.info('hi') // creates and logs {msg: 'hi', level: 30, time: <ts>} */ asObject?: boolean; formatters?: { /** * Changes the shape of the log level. * The default shape is { level: number }. */ level?: (label: string, number: number) => object; /** * Changes the shape of the log object. */ log?: (object: Record<string, unknown>) => Record<string, unknown>; }; /** * Instead of passing log messages to `console.log` they can be passed to a supplied function. If `write` is * set to a single function, all logging objects are passed to this function. If `write` is an object, it * can have methods that correspond to the levels. When a message is logged at a given level, the * corresponding method is called. If a method isn't present, the logging falls back to using the `console`. * * @example * const pino = require('pino')({ * browser: { * write: (o) => { * // do something with o * } * } * }) * * @example * const pino = require('pino')({ * browser: { * write: { * info: function (o) { * //process info log object * }, * error: function (o) { * //process error log object * } * } * } * }) */ write?: | WriteFn | ({ fatal?: WriteFn; error?: WriteFn; warn?: WriteFn; info?: WriteFn; debug?: WriteFn; trace?: WriteFn; } & { [logLevel: string]: WriteFn });
/** * The serializers provided to `pino` are ignored by default in the browser, including the standard * serializers provided with Pino. Since the default destination for log messages is the console, values * such as `Error` objects are enhanced for inspection, which they otherwise wouldn't be if the Error * serializer was enabled. We can turn all serializers on or we can selectively enable them via an array. * * When `serialize` is `true` the standard error serializer is also enabled (see * {@link https://github.com/pinojs/pino/blob/master/docs/api.md#pino-stdserializers}). This is a global * serializer which will apply to any `Error` objects passed to the logger methods. * * If `serialize` is an array the standard error serializer is also automatically enabled, it can be * explicitly disabled by including a string in the serialize array: `!stdSerializers.err` (see example). * * The `serialize` array also applies to any child logger serializers (see * {@link https://github.com/pinojs/pino/blob/master/docs/api.md#bindingsserializers-object} for how to * set child-bound serializers). * * Unlike server pino the serializers apply to every object passed to the logger method, if the `asObject` * option is `true`, this results in the serializers applying to the first object (as in server pino). * * For more info on serializers see * {@link https://github.com/pinojs/pino/blob/master/docs/api.md#serializers-object}. * * @example * const pino = require('pino')({ * browser: { * serialize: true * } * }) * * @example * const pino = require('pino')({ * serializers: { * custom: myCustomSerializer, * another: anotherSerializer * }, * browser: { * serialize: ['custom'] * } * }) * // following will apply myCustomSerializer to the custom property, * // but will not apply anotherSerializer to another key * pino.info({custom: 'a', another: 'b'}) * * @example * const pino = require('pino')({ * serializers: { * custom: myCustomSerializer, * another: anotherSerializer * }, * browser: { * serialize: ['!stdSerializers.err', 'custom'] //will not serialize Errors, will serialize `custom` keys * } * }) */ serialize?: boolean | string[];
/** * Options for transmission of logs. * * @example * const pino = require('pino')({ * browser: { * transmit: { * level: 'warn', * send: function (level, logEvent) { * if (level === 'warn') { * // maybe send the logEvent to a separate endpoint * // or maybe analyse the messages further before sending * } * // we could also use the `logEvent.level.value` property to determine * // numerical value * if (logEvent.level.value >= 50) { // covers error and fatal * * // send the logEvent somewhere * } * } * } * } * }) */ transmit?: { /** * Specifies the minimum level (inclusive) of when the `send` function should be called, if not supplied * the `send` function will be called based on the main logging `level` (set via `options.level`, * defaulting to `info`). */ level?: LevelOrString; /** * Remotely record log messages. * * @description Called after writing the log message. */ send: (level: Level, logEvent: LogEvent) => void; }; /** * The disabled option will disable logging in browser if set to true, by default it is set to false. * * @example * const pino = require('pino')({browser: {disabled: true}}) */ disabled?: boolean;};
Browser only, see http://getpino.io/#/docs/browser.
property crlf
crlf?: boolean;
logs newline delimited JSON with
\r\n
instead of\n
. Default:false
.
property customLevels
customLevels?: { [level in CustomLevels]: number };
Use this option to define additional logging levels. The keys of the object correspond the namespace of the log level, and the values should be the numerical value of the level.
property depthLimit
depthLimit?: number;
Stringification limit at a specific nesting depth when logging circular object. Default:
5
.
property edgeLimit
edgeLimit?: number;
Stringification limit of properties/elements when logging a specific object/array with circular references. Default:
100
.
property enabled
enabled?: boolean;
Enables logging. Default:
true
.
property errorKey
errorKey?: string;
The string key for the 'error' in the JSON object. Default: "err".
property formatters
formatters?: { /** * Changes the shape of the log level. * The default shape is { level: number }. * The function takes two arguments, the label of the level (e.g. 'info') and the numeric value (e.g. 30). */ level?: (label: string, number: number) => object; /** * Changes the shape of the bindings. * The default shape is { pid, hostname }. * The function takes a single argument, the bindings object. * It will be called every time a child logger is created. */ bindings?: (bindings: Bindings) => object; /** * Changes the shape of the log object. * This function will be called every time one of the log methods (such as .info) is called. * All arguments passed to the log method, except the message, will be pass to this function. * By default it does not change the shape of the log object. */ log?: (object: Record<string, unknown>) => Record<string, unknown>;};
An object containing functions for formatting the shape of the log lines. These functions should return a JSONifiable object and should never throw. These functions allow for full customization of the resulting log lines. For example, they can be used to change the level key name or to enrich the default metadata.
property hooks
hooks?: { /** * Allows for manipulating the parameters passed to logger methods. The signature for this hook is * logMethod (args, method, level) {}, where args is an array of the arguments that were passed to the * log method and method is the log method itself, and level is the log level. This hook must invoke the method function by * using apply, like so: method.apply(this, newArgumentsArray). */ logMethod?: ( this: Logger, args: Parameters<LogFn>, method: LogFn, level: number ) => void;};
An object mapping to hook functions. Hook functions allow for customizing internal logger operations. Hook functions must be synchronous functions.
property level
level?: LevelWithSilentOrString;
One of the supported levels or
silent
to disable logging. Any other value defines a custom level and requires supplying a level value vialevelVal
. Default: 'info'.
property levelComparison
levelComparison?: | 'ASC' | 'DESC' | ((current: number, expected: number) => boolean);
Use this option to define custom comparison of log levels. Useful to compare custom log levels or non-standard level values. Default: "ASC"
property levelVal
levelVal?: number;
When defining a custom log level via level, set to an integer value to define the new level. Default:
undefined
.
property messageKey
messageKey?: string;
The string key for the 'message' in the JSON object. Default: "msg".
property mixin
mixin?: MixinFn<CustomLevels>;
If provided, the
mixin
function is called each time one of the active logging methods is called. The function must synchronously return an object. The properties of the returned object will be added to the logged JSON.
property mixinMergeStrategy
mixinMergeStrategy?: MixinMergeStrategyFn;
If provided, the
mixinMergeStrategy
function is called each time one of the active logging methods is called. The first parameter is the valuemergeObject
or an empty object, the second parameter is the value resulting frommixin()
or an empty object. The function must synchronously return an object.
property msgPrefix
msgPrefix?: string;
A string that would be prefixed to every message (and child message)
property name
name?: string;
The name of the logger. Default:
undefined
.
property nestedKey
nestedKey?: string;
The string key to place any logged object under.
property onChild
onChild?: OnChildCallback<CustomLevels>;
Optional child creation callback.
property redact
redact?: string[] | redactOptions;
As an array, the redact option specifies paths that should have their values redacted from any log output.
Each path must be a string using a syntax which corresponds to JavaScript dot and bracket notation.
If an object is supplied, three options can be specified:
paths (String[]): Required. An array of paths censor (String): Optional. A value to overwrite key which are to be redacted. Default: '[Redacted]' remove (Boolean): Optional. Instead of censoring the value, remove both the key and the value. Default: false
property safe
safe?: boolean;
Avoid error causes by circular references in the object tree. Default:
true
.
property serializers
serializers?: { [key: string]: SerializerFn };
an object containing functions for custom serialization of objects. These functions should return an JSONifiable object and they should never throw. When logging an object, each top-level property matching the exact key of a serializer will be serialized using the defined serializer.
property timestamp
timestamp?: TimeFn | boolean;
Enables or disables the inclusion of a timestamp in the log message. If a function is supplied, it must synchronously return a JSON string representation of the time. If set to
false
, no timestamp will be included in the output. See stdTimeFunctions for a set of available functions for passing in as a value for this option. Caution: any sort of formatted time will significantly slow down Pino's performance.
property transport
transport?: | TransportSingleOptions | TransportMultiOptions | TransportPipelineOptions;
property useOnlyCustomLevels
useOnlyCustomLevels?: UseOnlyCustomLevels;
Use this option to only use defined
customLevels
and omit Pino's levels. Logger's defaultlevel
must be changed to a value incustomLevels
in order to useuseOnlyCustomLevels
Warning: this option may not be supported by downstream transports.
interface MultiStreamOptions
interface MultiStreamOptions {}
interface MultiStreamRes
interface MultiStreamRes<TOriginLevel = Level> {}
property add
add: <TLevel = Level>( dest: StreamEntry<TLevel> | DestinationStream) => MultiStreamRes<TOriginLevel & TLevel>;
property flushSync
flushSync: () => void;
property minLevel
minLevel: number;
property streams
streams: StreamEntry<TOriginLevel>[];
property write
write: (data: any) => void;
method clone
clone: <TLevel = Level>(level: TLevel) => MultiStreamRes<TLevel>;
interface StreamEntry
interface StreamEntry<TLevel = Level> {}
interface TransportBaseOptions
interface TransportBaseOptions<TransportOptions = Record<string, any>> {}
interface TransportMultiOptions
interface TransportMultiOptions<TransportOptions = Record<string, any>> extends TransportBaseOptions<TransportOptions> {}
interface TransportPipelineOptions
interface TransportPipelineOptions<TransportOptions = Record<string, any>> extends TransportBaseOptions<TransportOptions> {}
interface TransportSingleOptions
interface TransportSingleOptions<TransportOptions = Record<string, any>> extends TransportBaseOptions<TransportOptions> {}
property target
target: string;
interface TransportTargetOptions
interface TransportTargetOptions<TransportOptions = Record<string, any>> {}
type Bindings
type Bindings = Record<string, any>;
type DestinationStreamWithMetadata
type DestinationStreamWithMetadata = DestinationStream & ({ [symbols.needsMetadataGsym]?: false } | DestinationStreamHasMetadata);
type Level
type Level = 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace';
type LevelChangeEventListener
type LevelChangeEventListener< CustomLevels extends string = never, UseOnlyCustomLevels extends boolean = boolean> = ( lvl: LevelWithSilentOrString, val: number, prevLvl: LevelWithSilentOrString, prevVal: number, logger: Logger<CustomLevels, UseOnlyCustomLevels>) => void;
type LevelOrString
type LevelOrString = Level | (string & {});
type LevelWithSilent
type LevelWithSilent = pino.Level | 'silent';
type LevelWithSilentOrString
type LevelWithSilentOrString = LevelWithSilent | (string & {});
type LogDescriptor
type LogDescriptor = Record<string, any>;
type Logger
type Logger< CustomLevels extends string = never, UseOnlyCustomLevels extends boolean = boolean> = BaseLogger & LoggerExtras<CustomLevels> & CustomLevelLogger<CustomLevels, UseOnlyCustomLevels>;
type SerializedError
type SerializedError = pinoStdSerializers.SerializedError;
type SerializedRequest
type SerializedRequest = pinoStdSerializers.SerializedRequest;
type SerializedResponse
type SerializedResponse = pinoStdSerializers.SerializedResponse;
type SerializerFn
type SerializerFn = (value: any) => any;
type WriteFn
type WriteFn = (o: object) => void;
Package Files (1)
Dependencies (11)
Dev Dependencies (40)
- @types/flush-write-stream
- @types/node
- @types/tap
- @yao-pkg/pkg
- airtap
- benchmark
- bole
- bunyan
- debug
- docsify-cli
- eslint
- eslint-config-standard
- eslint-plugin-import
- eslint-plugin-n
- eslint-plugin-node
- eslint-plugin-promise
- execa
- fastbench
- flush-write-stream
- import-fresh
- jest
- log
- loglevel
- midnight-smoker
- pino-pretty
- pre-commit
- proxyquire
- pump
- rimraf
- semver
- split2
- steed
- strip-ansi
- tap
- tape
- through2
- ts-node
- tsd
- typescript
- winston
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/pino
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/pino)
- HTML<a href="https://www.jsdocs.io/package/pino"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 6653 ms. - Missing or incorrect documentation? Open an issue for this package.