react-native-easy-logger
v1.0.2
Published
- print log with custom prefix - don't print log in prd environment
Downloads
2
Readme
react-native-easy-logger
Features
- print log with custom prefix
- don't print log in prd environment
Install
npm install react-native-easy-logger --save
Usage
import Logger,{createLogger} from "react-native-easy-logger";
Logger.log("easy logger:","test")
Logger.info("easy logger:","test")
Logger.warn("easy logger:","test")
Logger.error("easy logger:","test")
Logger.configLogger({
prefixTemplate:"=======$prefix=========:"
})
Logger.log("easy logger:","test")
Logger.info("easy logger:","test")
Logger.warn("easy logger:","test")
Logger.error("easy logger:","test")
const newLogger = createLogger({
prefixTemplate:"-------- $prefix --------:"
})
newLogger.info("new easy logger","new test")
Logger.table({
a:{ num: "1"},
b:{ num: "2"},
c:{ num: "3" }
})
Logger.table("table",{
a:{ num: "1"},
b:{ num: "2"},
c:{ num: "3" }
})
Methods
createLogger(options)
configLogger(options)
config options
| name | description | type | default | | ------------ | ------------ | ------------ | ------------ | | prefixTemplate | prefix template | string | empty string | | prefixPlaceholder | prefix placeholder | string | $prefix | | prdDebug | prd environment can print log | boolean | false |
log(args)
print log without prefix
info(prefix,args)
print log with prefix
warn(prefix,args)
print warning log
error(prefix,args)
print error log