diff --git a/package.json b/package.json index a4a2fd5..44a9f3d 100644 --- a/package.json +++ b/package.json @@ -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": [ diff --git a/src/index.ts b/src/index.ts index 14f8444..52ae15b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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; @@ -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' } );