Last active
June 30, 2017 19:23
-
-
Save Zielak/c45544dff63903b929a43cc141dc917e to your computer and use it in GitHub Desktop.
Wraps console log, warn, info and error. Will add module's name before printing log. Userful when you have bunch of modules logging different stuff
This file contains hidden or 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 MODULE_NAME = 'ModuleX' | |
const log = (...args) => console.log.apply(console, [`[${MODULE_NAME}] > `, ...args]) | |
const info = (...args) => console.info.apply(console, [`[${MODULE_NAME}] > `, ...args]) | |
const warn = (...args) => console.warn.apply(console, [`[${MODULE_NAME}] > `, ...args]) | |
const error = (...args) => console.error.apply(console, [`[${MODULE_NAME}] > `, ...args]) | |
log('testing', ['apple', 'orange', 'car'], 1337) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment