Skip to content

Commit

Permalink
Added [vscode-deephaven] label to make it easier to filter debug logs (
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Jan 17, 2025
1 parent eef35a8 commit b61e268
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/util/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,18 @@ export class Logger {
* Register log handler that logs to console.
*/
static addConsoleHandler = (): void => {
const createHandler =
(level: Exclude<LogLevel, 'debug2'>): LogLevelHandler =>
(...args) =>
/* eslint-disable no-console */
console[level]('[vscode-deephaven]', ...args);

Logger.handlers.add({
/* eslint-disable no-console */
error: console.error.bind(console),
warn: console.warn.bind(console),
info: console.info.bind(console),
debug: console.debug.bind(console),
debug2: console.debug.bind(console),
error: createHandler('error'),
warn: createHandler('warn'),
info: createHandler('info'),
debug: createHandler('debug'),
debug2: createHandler('debug'),
/* eslint-enable no-console */
});
};
Expand Down

0 comments on commit b61e268

Please sign in to comment.