config/index.js 区分 dev prod,fixed store.js userpage.js 等
This commit is contained in:
1 parent
ea2267598b
commit
883919244f
8 files changed
+44
-23
No files matched your search
@@ -0,0 +1,17 @@
|
||||
export const IS_DEV = process.env.NODE_ENV !== 'production'
|
||||
|
||||
const noop = () => {}
|
||||
|
||||
function createLogMethod(method) {
|
||||
if (IS_DEV) {
|
||||
return (...args) => console[method](...args)
|
||||
}
|
||||
return noop
|
||||
}
|
||||
|
||||
export const logger = {
|
||||
debug: createLogMethod('log'),
|
||||
info: createLogMethod('info'),
|
||||
warn: createLogMethod('warn'),
|
||||
error: createLogMethod('error'),
|
||||
}
|
||||
Reference in new issue
Block a user