Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit f79efe0

Browse files
author
Michal Vlasák
committed
Fix write function type, fix typos
1 parent c668f43 commit f79efe0

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export interface AckeeLoggerFactory extends AckeeLogger {
3939
(data: string | AckeeLoggerOptions): AckeeLogger;
4040
}
4141

42-
// This is a custom slightly edited version of pino-multistream's wirte method, whch adds support for maximum log level
42+
// This is a custom slightly edited version of pino-multistream's write method, which adds support for maximum log level
4343
// The original version was pino-multistream 3.1.2 (commit 71d98ae) - https://github.com/pinojs/pino-multi-stream/blob/71d98ae191e02c56e39e849d2c30d59c8c6db1b9/multistream.js#L43
4444
const maxLevelWrite: pino.WriteFn = function(this: any, data: object): void {
4545
let stream;
@@ -129,7 +129,11 @@ const defaultLogger = (options: AckeeLoggerOptions = {}): AckeeLogger => {
129129

130130
// Add maxLevel support to pino-multi-stream
131131
// This could be replaced with custom pass-through stream being passed to multistream, which would filter the messages
132-
logger.stream.write = maxLevelWrite.bind(logger.stream);
132+
const streamMaxLevelWrite = maxLevelWrite.bind(logger.stream);
133+
logger.stream.write = (chunk: any) => {
134+
streamMaxLevelWrite(chunk);
135+
return true;
136+
};
133137
logger.express = expressMiddleware.bind(logger);
134138
logger.expressError = expressErrorMiddleware as any;
135139

0 commit comments

Comments
 (0)