cordova-logger-plugin
v0.0.2
Published
Cordova Plugin Logger
Maintainers
Readme
cordova-logger-plugin
This is a simple cordova plugin written in Kotlin and Swift that helps write logs to the device console.
Platforms
iOS
android
Dependencies
[email protected]that usesSwift 4cordova 12cordova-ios 7cordova-android 13
Installation
cordova plugin add cordova-logger-pluginMethods
- log
Reference
LoggerConstants.LogType
| Property | Value | Description | | -------- | ------------------------ | ----------- | | INFO | "info" | | ERROR | "error" | | WARN | "warn" |
LoggerConstants.Tag
| Property | Value | Description | | -------- | ------------------------- | --------------------------------------------- | | DEFAULT | "Logger" | the default tag used in logs to aid filtering |
logOptions
| Property | Type | Default |
| -------- | ------------------------ | -------------------------------------- |
| logType | LogType | LogType.INFO |
| tag | Tag | Tag.DEFAULT |
| message | string | ❗ calls onError if not specified ❗ |
Examples
| Param | Type | | ------- | --------------------------- | | success | onSuccess | | error | onError | | options | logOptions |
const logOptions = {
logType: LoggerConstants.LogType.ERROR,
tag: "MyApplicationName",
message: "Your message",
};
function onSuccess() {
console.log("Message logged successfully");
}
function onError(message) {
console.log(`Message log failed ${message}`);
}
cordova.plugins.Logger.log(options, onSuccess, onError);