cordova-logger
v0.0.6
Published
Cordova logger for android
Downloads
5
Maintainers
Readme
Cordova-logger
Cordova logger system for android
First
Before cordova-logger, you should install cordova-plugin-file and cordova-plugin-android-permissions first.
You should install cordova-logger in Front-End project folder.
Usage
import Logger from "cordova-logger"
const logger = new Logger({
folder: "cordova",
column: "log",
filename: "file.log"
})
logger.info("logger", "string") // [2020-2-2 22:13:54.551] [INFO] logger [ext] string
logger.checkFileWritePriority() // return true or false
logger.requestFileWritePriority('folder', 'column', 'file') // request app write permission
logger.checkExternalFileExistOrNot('filename') // return true or false
console.log("logger", logger)
Functions
- Only logger.debug doesn't log to file, all of them can be print in console.
- Only identify 999 levels in input value which contains object or array.
- Data type includes Number, String, Undefined, Null, Boolean, Object, Array, Function, Error, Set, Map and Symbol can be support stringify. If something can't be stringify, it will be print data type, such as DOM element, it will print '[object HTMLDivElement]'
- Although we support print Function, Set, Map and Symbol directly, we still don't recommend to print it without any transfer, and it will give a warn to remind you if you set dataTypeWarn to be true.
- Support new multiple cordova-logger instance to log different files.
logger.checkFileWritePriority
could check app have file write permission or notlogger.requestFileWritePriority
request app write permissionlogger.checkExternalFileExistOrNot
check file exist or not- All of logger method support Promise chain call