     
     func setCapture(command: CDVInvokedUrlCommand){
         
-        guard let enabled  = command.arguments[0] as? Bool else {
-            let message = "Enabled Parameter is Invalid."
-            let pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAsString: message)
-            // call error callback
-            self.commandDelegate!.sendPluginResult(pluginResult, callbackId:command.callbackId)
-            return
-        }
-        
-        self.commandDelegate!.runInBackground({
+        self.commandDelegate!.runInBackground({
+            
+            guard let enabled  = command.arguments[0] as? Bool else {
+                let message = "Enabled Parameter is Invalid."
+                let pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAsString: message)
+                // call error callback
+                self.commandDelegate!.sendPluginResult(pluginResult, callbackId:command.callbackId)
+                return
+            }
+            
+            
             IMFLogger.setCapture(enabled)
         })
     }

    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>())
        })

    func setMaxStoreSize(command: CDVInvokedUrlCommand){
        // parms: [maxStoreSize]
        
        self.commandDelegate!.runInBackground({
            
            guard let maxStoreSize  = (command.arguments[0] as? Int) else {
                let message = "MaxStoreSize is Invalid."
                let pluginResult = CDVPluginResult(status: CDVCommandStatus_ERROR, messageAsString: message)
                // call error callback
                self.commandDelegate!.sendPluginResult(pluginResult, callbackId:command.callbackId)
                return
            }
            
            IMFLogger.setMaxStoreSize(Int32(maxStoreSize))
        })
    }
