Created
September 2, 2019 00:28
-
-
Save aaronmccall/a0e7d52c1fc94764c024db15576a3878 to your computer and use it in GitHub Desktop.
Add seconds.milliseconds at the end of every console call
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
const now = () => new Date().toISOString().replace(/^.*:([\d.]+)Z$/, '$1') | |
if ( | |
process.env.NODE_ENV === 'development' | |
|| (localStorage.debug === 'true' && !console.__ts__) | |
) { | |
['log', 'debug', 'info', 'warn', 'error'].forEach(method => { | |
const original = console[method] | |
console[method] = (...args) => original.call(console, ...args, `| ${now()}`) | |
}) | |
console.__ts__ = true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment