pino#LoggerOptions TypeScript Examples
The following examples show how to use
pino#LoggerOptions.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: utils.ts From walletconnect-utils with MIT License | 6 votes |
export function getDefaultLoggerOptions(opts?: LoggerOptions): LoggerOptions {
return {
...opts,
level: opts?.level || PINO_LOGGER_DEFAULTS.level,
prettyPrint: opts?.prettyPrint || PINO_LOGGER_DEFAULTS.prettyPrint,
};
}
Example #2
Source File: logger.ts From one-platform with MIT License | 5 votes |
setupLogger = (): Logger<LoggerOptions> => {
const logger = pino();
return logger;
}
Example #3
Source File: index.spec.ts From pino-lambda with MIT License | 5 votes |
/**
* Creates a test logger and output buffer for assertions
* Returns the logger and the buffer
*
* CAUTION:
* Usage defined below is for the purposes of the Test Harness
* and is not reflective of the actual usage of pino-lambda
*/
function createLogger(
options?: LoggerOptions,
mixedOptions?: LambdaRequestTrackerOptions & PinoLambdaOptions,
): {
log: Logger;
output: { buffer: string };
withRequest: (event: LambdaEvent, context: LambdaContext) => void;
} {
const output = {
buffer: 'undefined',
};
const destination = pinoLambdaDestination({
...mixedOptions,
streamWriter: (str: string | Uint8Array): boolean => {
output.buffer = (str as string).trim();
return true;
},
});
const log = pino(
{
base: null,
...options,
},
destination,
);
const withRequest = lambdaRequestTracker({
...mixedOptions,
});
return { log, output, withRequest };
}