added comments
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
let _custom_console_log_injected = false
|
||||
if (!_custom_console_log_injected) {
|
||||
_custom_console_log_injected = true
|
||||
// Replaces console.log with a version that prefixes a timestamp
|
||||
function injectConsoleLog() {
|
||||
const originalLog = console.log
|
||||
|
||||
function customLog(message?: any, ...optionalParams: any[]) {
|
||||
const now = new Date()
|
||||
const timestamp = now.toTimeString().split(' ')[0] // hh:mm:ss
|
||||
originalLog(`[${timestamp}] ${message}`, ...optionalParams, ':3')
|
||||
originalLog(`[${timestamp}] ${message}`, ...optionalParams)
|
||||
}
|
||||
|
||||
console.log = customLog
|
||||
return null
|
||||
}
|
||||
|
||||
// Run once at first file import
|
||||
export const _inject_run_once = injectConsoleLog()
|
||||
|
||||
Reference in New Issue
Block a user