Skip to content

Commit

Permalink
fix(getTransformStream): compare opts.logLevelInString as boolean (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
JacopoDaeli authored May 28, 2021
1 parent 2683925 commit 1bca0bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ test("API", (t) => {

const transform = getTransformStream({
logFormat: "json",
logLevelInString: true,
});
transform.pipe(streamLogsToOutput);
const log = pino({}, transform);
Expand All @@ -155,6 +156,8 @@ test("API", (t) => {
'No "\\n" is added to end of line'
);

t.equal(JSON.parse(output).level, "info");

t.end();
}
);
Expand Down

0 comments on commit 1bca0bb

Please sign in to comment.