     
     // This flag prevents infinite loops of uncaught exceptions
     internal static var exceptionHasBeenCalled = false
-    
+    internal static var isNSException = false
     internal static func startCapturingUncaughtExceptions() {
         
         NSSetUncaughtExceptionHandler { (uncaughtException: NSException) -> Void in
-            
+            BMSLogger.isNSException = true
             if (!BMSLogger.exceptionHasBeenCalled) {
                 // Persist a flag so that when the app starts back up, we can see if an exception occurred in the last session
                 BMSLogger.exceptionHasBeenCalled = true

                BMSLogger.existingUncaughtExceptionHandler?(uncaughtException)
            }
        }
    }
    
    
    internal static func log(exception uncaughtException: NSException) {
        
        var metadata: [String: Any] = [:]

                BMSLogger.existingUncaughtExceptionHandler?(uncaughtException)
            }
        }
        if(!BMSLogger.isNSException){
            BMSLogger.checkSignal()
        }
    }
    
    
    internal static func checkSignal(){
         NSSetUncaughtExceptionHandler { (exception) in
            let signalValue = exception.name
            let signalReason = exception.reason
            BMSLogger.logOtherThanNSException(trace: exception.callStackSymbols, signalValue:signalValue, signalReason:signalReason! );
         }

        signal(SIGSEGV) { signal in
            let signalReason = String.fromCString(strsignal(signal))
            let signalValue = "SIGSEGV"
            BMSLogger.logOtherThanNSException(trace: NSThread.callStackSymbols(), signalValue:signalValue, signalReason:signalReason!);
        }

        signal(SIGABRT) { signal in
            let signalReason = String.fromCString(strsignal(signal))
            let signalValue = "SIGABRT"
            BMSLogger.logOtherThanNSException(trace: NSThread.callStackSymbols(), signalValue:signalValue, signalReason:signalReason!);
        }

        signal(SIGILL) { signal in
            let signalReason = String.fromCString(strsignal(signal))
            let signalValue = "SIGILL"
            BMSLogger.logOtherThanNSException(trace: NSThread.callStackSymbols(), signalValue:signalValue, signalReason:signalReason!);
        }

        signal(SIGFPE) { signal in
            let signalReason = String.fromCString(strsignal(signal))
            let signalValue = "SIGFPE"
            BMSLogger.logOtherThanNSException(trace: NSThread.callStackSymbols(), signalValue:signalValue, signalReason:signalReason!);
        }

        signal(SIGBUS) { signal in
            let signalReason = String.fromCString(strsignal(signal))
            let signalValue = "SIGBUS"
            BMSLogger.logOtherThanNSException(trace: NSThread.callStackSymbols(), signalValue:signalValue, signalReason:signalReason!);
        }

        signal(SIGPIPE) { signal in
            let signalReason = String.fromCString(strsignal(signal))
            let signalValue = "SIGPIPE"
            BMSLogger.logOtherThanNSException(trace: NSThread.callStackSymbols(), signalValue:signalValue, signalReason:signalReason!);
        }
    }

    internal static func logOtherThanNSException(trace crashTrace: [String], signalValue:String, signalReason:String) {

        if (!BMSLogger.exceptionHasBeenCalled) {

            let message = "App Crash: Crashed with signal \(signalValue) (\(signalReason))"

            // Persist a flag so that when the app starts back up, we can see if an exception occurred in the last session
            BMSLogger.exceptionHasBeenCalled = true

            let exceptionString = message
            let stacktrace = crashTrace

            var metadata: [String: AnyObject] = [:]

            metadata[Constants.Metadata.Analytics.stacktrace] = stacktrace
            metadata[Constants.Metadata.Analytics.exceptionClass] = ""
            metadata[Constants.Metadata.Analytics.exceptionMessage] = message

            Logger.delegate?.logToFile(message: exceptionString, level: LogLevel.fatal, loggerName: Constants.Package.logger, calledFile: #file, calledFunction: #function, calledLineNumber: #line, additionalMetadata: metadata)

            BMSAnalytics.logSessionEnd()
            
            abort()
        }
    }

    internal static func log(exception uncaughtException: NSException) {

        var metadata: [String: AnyObject] = [:]
