File tree 1 file changed +21
-18
lines changed 1 file changed +21
-18
lines changed Original file line number Diff line number Diff line change @@ -214,7 +214,9 @@ export function setUserLogHandler(
214
214
options : LogOptions
215
215
) : void {
216
216
if ( logCallback !== null && typeof logCallback !== 'function' ) {
217
- throw new TypeError ( 'First argument to `onLog` must be null or a function.' ) ;
217
+ throw new TypeError (
218
+ 'First argument to `onLog` must be null or a function.'
219
+ ) ;
218
220
}
219
221
for ( const instance of instances ) {
220
222
let threshhold = instance . logLevel ;
@@ -229,25 +231,26 @@ export function setUserLogHandler(
229
231
level : LogLevel ,
230
232
...args : unknown [ ]
231
233
) => {
232
- const message = args . map ( arg => {
233
- if ( arg == null ) {
234
- return null ;
235
- } else if ( typeof arg === 'string' ) {
236
- return arg ;
237
- } else if ( typeof arg === 'number' || typeof arg === 'boolean' ) {
238
- return arg . toString ( ) ;
239
- } else if ( arg instanceof Error ) {
240
- return arg . message ;
241
- } else {
242
- try {
243
- return JSON . stringify ( arg ) ;
244
- } catch ( ignored ) {
234
+ const message = args
235
+ . map ( arg => {
236
+ if ( arg == null ) {
245
237
return null ;
238
+ } else if ( typeof arg === 'string' ) {
239
+ return arg ;
240
+ } else if ( typeof arg === 'number' || typeof arg === 'boolean' ) {
241
+ return arg . toString ( ) ;
242
+ } else if ( arg instanceof Error ) {
243
+ return arg . message ;
244
+ } else {
245
+ try {
246
+ return JSON . stringify ( arg ) ;
247
+ } catch ( ignored ) {
248
+ return null ;
249
+ }
246
250
}
247
- }
248
- } )
249
- . filter ( arg => arg )
250
- . join ( ' ' ) ;
251
+ } )
252
+ . filter ( arg => arg )
253
+ . join ( ' ' ) ;
251
254
if ( level >= threshhold ) {
252
255
logCallback ( {
253
256
level : LogLevel [ level ] . toLowerCase ( ) as LogLevelString ,
You can’t perform that action at this time.
0 commit comments