-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix failures on the pipelines due to memory issues (#1206)
The testkit pipelines are failing given the log size generated from the testkit tests. This PR enables the configuration of log levels for testkit backend ('info' by default) and downgrades the message parameters messages to 'debug' for saving space on logs.
- Loading branch information
Showing
7 changed files
with
60 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const originalConsole = console | ||
|
||
const config = { | ||
level: 'info', | ||
canRun: (method) => { | ||
if (config.level === 'debug') { | ||
return true | ||
} else if (config.level === 'info') { | ||
return method !== 'debug' | ||
} else if (config.level === 'warn') { | ||
return method !== 'debug' && | ||
method !== 'log' | ||
} else if (config.level === 'error') { | ||
return method !== 'debug' && | ||
method !== 'log' && | ||
method !== 'warn' | ||
} | ||
return true | ||
} | ||
} | ||
|
||
export default { | ||
install (level = 'info') { | ||
this.setLevel(level) | ||
// eslint-disable-next-line no-global-assign | ||
console = new Proxy({}, { | ||
get: (_, method) => (...args) => { | ||
if (config.canRun(method)) { | ||
originalConsole[method].apply(originalConsole, args) | ||
} | ||
} | ||
}) | ||
}, | ||
setLevel (level) { | ||
config.level = (level || 'info').toLowerCase() | ||
}, | ||
uninstall () { | ||
config.level = 'info' | ||
// eslint-disable-next-line no-global-assign | ||
console = originalConsole | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters