diff --git a/index.js b/index.js index 037ed58..86dd4d0 100644 --- a/index.js +++ b/index.js @@ -24,7 +24,7 @@ const LEVEL_MAP = { function getTransformStream(options = {}) { const formattingEnabled = options.logFormat !== "json"; - const levelAsString = options.logLevelInString === "true"; + const levelAsString = options.logLevelInString; const sentryEnabled = !!options.sentryDsn; if (sentryEnabled) { diff --git a/test/index.test.js b/test/index.test.js index f702eed..dd9cdac 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -143,6 +143,7 @@ test("API", (t) => { const transform = getTransformStream({ logFormat: "json", + logLevelInString: true, }); transform.pipe(streamLogsToOutput); const log = pino({}, transform); @@ -155,6 +156,8 @@ test("API", (t) => { 'No "\\n" is added to end of line' ); + t.equal(JSON.parse(output).level, "info"); + t.end(); } );