Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
[1.3.1] Allow custom destination
Browse files Browse the repository at this point in the history
  • Loading branch information
auguwu committed Mar 12, 2023
1 parent e957cbb commit cb4541f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@augu/pino-transport",
"description": "🐻‍❄️🌲 Pino transport that roughly matches what I like to see in my logs",
"version": "1.3.0",
"version": "1.3.1",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
Expand Down
11 changes: 6 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ export { createSerializers };
export interface TransportOptions {
transport?: BaseFormatter;
json?: boolean;
dest?: string | number;
}

const transport = ({ transport, json }: TransportOptions) =>
const transport = ({ transport, json, dest }: TransportOptions) =>
createAbstractTransport(
(stream) => {
let selectedTransport: BaseFormatter;
Expand All @@ -59,13 +60,13 @@ const transport = ({ transport, json }: TransportOptions) =>
}
});

const dest = new SonicBoom({
const destination = new SonicBoom({
append: true,
dest: 1
dest: dest || 1
});

stream.on('unknown', (line) => dest.write(`${line}\n`));
pump(stream, wrapper, dest);
stream.on('unknown', (line) => destination.write(`${line}\n`));
pump(stream, wrapper, destination);
},
{ parse: 'lines' }
);
Expand Down

0 comments on commit cb4541f

Please sign in to comment.