Last active
October 17, 2017 08:30
-
-
Save TianyiLi/74c38c4020430eb7cb419d1e62e77625 to your computer and use it in GitHub Desktop.
javascript lines track
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
export function logger(...arg){ | |
let parrent = new Error() | |
.stack | |
.split("\n")[2] | |
.trim() | |
.replace(/^at /, '') | |
.replace(__dirname, '') | |
let log = arg.forEach(e=>{ e = typeof e === 'string' ? e : JSON.stringify(e, null, 4)}).join(' ') | |
return log | |
} | |
export default logger |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment