Skip to content

Commit

Permalink
fix: show correct log method (#2644)
Browse files Browse the repository at this point in the history
There are other APIs that are reported differently on CDP level.
  • Loading branch information
Lightning00Blade authored Sep 25, 2024
1 parent da6e331 commit 4c66419
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/bidiMapper/modules/log/LogManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,21 @@ function getLogLevel(consoleApiType: string): Log.Level {
return Log.Level.Info;
}

function getLogMethod(consoleApiType: string): string {
switch (consoleApiType) {
case 'warning':
return 'warn';
case 'startGroup':
return 'group';
case 'startGroupCollapsed':
return 'groupCollapsed';
case 'endGroup':
return 'groupEnd';
}

return consoleApiType;
}

export class LogManager {
readonly #eventManager: EventManager;
readonly #realmStorage: RealmStorage;
Expand Down Expand Up @@ -169,8 +184,7 @@ export class LogManager {
timestamp: Math.round(params.timestamp),
stackTrace: getBidiStackTrace(params.stackTrace),
type: 'console',
// Console method is `warn`, not `warning`.
method: params.type === 'warning' ? 'warn' : params.type,
method: getLogMethod(params.type),
args,
},
},
Expand Down

0 comments on commit 4c66419

Please sign in to comment.