     func fatal(command: CDVInvokedUrlCommand){
         // parms: [name, message]
         
-        guard let name  = command.arguments[0] as? String else {
-            let message = "Name  Parameter is Invalid."
-            let pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAsString: message)
-            // call error callback
-            self.commandDelegate!.sendPluginResult(pluginResult, callbackId:command.callbackId)
-            return
-        }
-        
-        guard let message  = command.arguments[1] as? String else {
-            let msg = "message  Parameter is Invalid."
-            let pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAsString: msg)
-            // call error callback
-            self.commandDelegate!.sendPluginResult(pluginResult, callbackId:command.callbackId)
-            return
-        }
-        
-        self.commandDelegate!.runInBackground({
+        self.commandDelegate!.runInBackground({
+            
+            guard let name  = command.arguments[0] as? String else {
+                let message = "Name  Parameter is Invalid."
+                let pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAsString: message)
+                // call error callback
+                self.commandDelegate!.sendPluginResult(pluginResult, callbackId:command.callbackId)
+                return
+            }
+            
+            guard let message  = command.arguments[1] as? String else {
+                let msg = "message  Parameter is Invalid."
+                let pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAsString: msg)
+                // call error callback
+                self.commandDelegate!.sendPluginResult(pluginResult, callbackId:command.callbackId)
+                return
+            }
             
             let logger = IMFLogger(forName: name)
             logger.logWithLevel(.Fatal, message: message, args: CVaListPointer(_fromUnsafeMutablePointer: nil), userInfo:Dictionary<String, String>())

    func warn(command: CDVInvokedUrlCommand){
        // parms: [name, message]
        
        guard let name  = command.arguments[0] as? String else {
            let message = "Name  Parameter is Invalid."
            let pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAsString: message)
            // call error callback
            self.commandDelegate!.sendPluginResult(pluginResult, callbackId:command.callbackId)
            return
        }
        
        guard let message  = command.arguments[1] as? String else {
            let msg = "message  Parameter is Invalid."
            let pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAsString: msg)
            // call error callback
            self.commandDelegate!.sendPluginResult(pluginResult, callbackId:command.callbackId)
            return
        }
        
        self.commandDelegate!.runInBackground({
          
            let logger = IMFLogger(forName: name)
            logger.logWithLevel(.Warn, message: message, args: CVaListPointer(_fromUnsafeMutablePointer: nil), userInfo:Dictionary<String, String>())
        })


@objc(CDVMFPLogger) class CDVMFPLogger : CDVPlugin {
    
    let logLevelDictionary: Dictionary<String,IMFLogLevel> = [
        "TRACE"     : IMFLogLevel.Trace,
        "DEBUG"     : IMFLogLevel.Debug,
        "LOG"       : IMFLogLevel.Log,
        "INFO"      : IMFLogLevel.Info,
        "WARN"      : IMFLogLevel.Warn,
        "ERROR"     : IMFLogLevel.Error,
        "FATAL"     : IMFLogLevel.Fatal,
        "ANALYTICS" : IMFLogLevel.Analytics,
    ]

    func getInstance(command: CDVInvokedUrlCommand){
        // parms: [name]

        self.commandDelegate!.runInBackground({

        guard let name  = command.arguments[0] as? String else {
            let message = "Name  Parameter is Invalid."
            let pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAsString: message)
