mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-08 09:43:42 +01:00
26 lines
545 B
TypeScript
26 lines
545 B
TypeScript
|
const originalConsole = console;
|
||
|
|
||
|
declare let console: any;
|
||
|
|
||
|
export function interceptConsole(interceptions: any): object {
|
||
|
console = {
|
||
|
log: function () {
|
||
|
// eslint-disable-next-line
|
||
|
interceptions.log = arguments;
|
||
|
},
|
||
|
warn: function () {
|
||
|
// eslint-disable-next-line
|
||
|
interceptions.warn = arguments;
|
||
|
},
|
||
|
error: function () {
|
||
|
// eslint-disable-next-line
|
||
|
interceptions.error = arguments;
|
||
|
},
|
||
|
};
|
||
|
return interceptions;
|
||
|
}
|
||
|
|
||
|
export function restoreConsole() {
|
||
|
console = originalConsole;
|
||
|
}
|