mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-05 01:30:17 +00:00
Add missing time functions from http://getpino.io/#/docs/api?id=pinostdtimefunctions-object (#41618)
This commit is contained in:
committed by
Eli Barzilay
parent
46ea8c2e2a
commit
22de4f4659
26
types/pino/index.d.ts
vendored
26
types/pino/index.d.ts
vendored
@@ -126,10 +126,18 @@ declare namespace P {
|
||||
* The default time function for Pino. Returns a string like `,"time":1493426328206`.
|
||||
*/
|
||||
epochTime: TimeFn;
|
||||
/*
|
||||
* Returns the seconds since Unix epoch
|
||||
*/
|
||||
unixTime: TimeFn;
|
||||
/**
|
||||
* Returns an empty string. This function is used when the `timestamp` option is set to `false`.
|
||||
*/
|
||||
nullTime: TimeFn;
|
||||
/*
|
||||
* Returns ISO 8601-formatted time in UTC
|
||||
*/
|
||||
isoTime: TimeFn;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -319,13 +327,13 @@ declare namespace P {
|
||||
write?:
|
||||
| WriteFn
|
||||
| ({
|
||||
fatal?: WriteFn;
|
||||
error?: WriteFn;
|
||||
warn?: WriteFn;
|
||||
info?: WriteFn;
|
||||
debug?: WriteFn;
|
||||
trace?: WriteFn;
|
||||
} & { [logLevel: string]: 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
|
||||
@@ -414,14 +422,14 @@ declare namespace P {
|
||||
* the `send` function will be called based on the main logging `level` (set via `options.level`,
|
||||
* defaulting to `info`).
|
||||
*/
|
||||
level?: Level|string;
|
||||
level?: Level | string;
|
||||
/**
|
||||
* Remotely record log messages.
|
||||
*
|
||||
* @description Called after writing the log message.
|
||||
*/
|
||||
send: (level: Level, logEvent: LogEvent) => void;
|
||||
}
|
||||
};
|
||||
};
|
||||
/**
|
||||
* key-value object added as child logger to each log line. If set to null the base child logger is not added
|
||||
|
||||
@@ -173,6 +173,10 @@ const pretty = pino({
|
||||
}
|
||||
});
|
||||
|
||||
const withTimeFn = pino({
|
||||
timestamp: pino.stdTimeFunctions.isoTime,
|
||||
});
|
||||
|
||||
// Properties/types imported from pino-std-serializers
|
||||
const wrappedErrSerializer = pino.stdSerializers.wrapErrorSerializer((err: pino.SerializedError) => {
|
||||
return {...err, newProp: 'foo'};
|
||||
|
||||
Reference in New Issue
Block a user