Skip to content

Commit de05d49

Browse files
committed
Merge branch 'master' of github.com:pinojs/pino
2 parents f1aa631 + e6d355c commit de05d49

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

lib/tools.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function genLog (level, hook) {
5353
}
5454
this[writeSym](o, format(msg, formatParams, this[formatOptsSym]), level)
5555
} else {
56-
this[writeSym](null, format(o, n, this[formatOptsSym]), level)
56+
this[writeSym](null, format(o === undefined ? n.shift() : o, n, this[formatOptsSym]), level)
5757
}
5858
}
5959
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
"tape": "^5.5.3",
105105
"through2": "^4.0.0",
106106
"ts-node": "^10.9.1",
107-
"tsd": "^0.23.0",
107+
"tsd": "^0.24.1",
108108
"typescript": "^4.8.2",
109109
"winston": "^3.7.2"
110110
},

test/basic.test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,22 @@ function levelTest (name, level) {
109109
same(Object.keys(obj), ['hello'])
110110
})
111111

112+
test(`passing a undefined and a string at level ${name}`, async ({ equal, same }) => {
113+
const stream = sink()
114+
const instance = pino(stream)
115+
instance.level = name
116+
instance[name](undefined, 'a string')
117+
const result = await once(stream, 'data')
118+
equal(new Date(result.time) <= new Date(), true, 'time is greater than Date.now()')
119+
delete result.time
120+
same(result, {
121+
pid,
122+
hostname,
123+
level,
124+
msg: 'a string'
125+
})
126+
})
127+
112128
test(`overriding object key by string at level ${name}`, async ({ equal, same }) => {
113129
const stream = sink()
114130
const instance = pino(stream)

0 commit comments

Comments
 (0)