Comparing version 7.8.2 to 7.9.0
@@ -65,6 +65,12 @@ "use strict"; | ||
else { | ||
let fallbackMessage = b; | ||
if (typeof b !== 'string') { | ||
throw new TypeError('Message must be a string. Received ' + typeof b + '.'); | ||
if (b === undefined) { | ||
fallbackMessage = ''; | ||
} | ||
else { | ||
throw new TypeError('Message must be a string. Received ' + typeof b + '.'); | ||
} | ||
} | ||
message = (0, fast_printf_1.printf)(b, c, d, e, f, g, h, i, j); | ||
message = (0, fast_printf_1.printf)(fallbackMessage, c, d, e, f, g, h, i, j); | ||
} | ||
@@ -71,0 +77,0 @@ onMessage({ |
@@ -63,2 +63,25 @@ "use strict"; | ||
}); | ||
(0, ava_1.default)('logs an empty message when first parameter is an object and the second parameter is undefined', (t) => { | ||
const log = createLoggerWithHistory(); | ||
// @ts-expect-error Invalid invocation | ||
log({}); | ||
t.deepEqual(log.messages, [ | ||
{ | ||
context: {}, | ||
message: '', | ||
sequence: '0', | ||
time, | ||
version, | ||
}, | ||
]); | ||
}); | ||
(0, ava_1.default)('throws in case of invalid invocation', (t) => { | ||
const log = createLoggerWithHistory(); | ||
t.throws(() => { | ||
// @ts-expect-error Invalid invocation | ||
log({}, {}); | ||
}, { | ||
message: 'Message must be a string. Received object.', | ||
}); | ||
}); | ||
(0, ava_1.default)('formats message using sprintf', (t) => { | ||
@@ -65,0 +88,0 @@ const log = createLoggerWithHistory(); |
@@ -75,3 +75,3 @@ { | ||
"typings": "./dist/src/Roarr.d.ts", | ||
"version": "7.8.2" | ||
"version": "7.9.0" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80405
42
1626
4