From e16b93fbd0815f686b6da33792c000827aaa014f Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Fri, 19 May 2017 13:30:09 +0300 Subject: [PATCH] logging to Instabug --- ios/StatusIm/AppDelegate.m | 4 ++++ src/status_im/ios/core.cljs | 4 +--- src/status_im/utils/handlers.cljs | 6 +++--- src/status_im/utils/instabug.cljs | 20 ++++++++++++++------ 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/ios/StatusIm/AppDelegate.m b/ios/StatusIm/AppDelegate.m index aa7c525c47..69c764727a 100644 --- a/ios/StatusIm/AppDelegate.m +++ b/ios/StatusIm/AppDelegate.m @@ -12,6 +12,7 @@ #import "RCTBundleURLProvider.h" #import "RCTRootView.h" #import "SplashScreen.h" +@import Instabug; @implementation AppDelegate @@ -34,6 +35,9 @@ self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; [SplashScreen show]; +#ifndef DEBUG + [Instabug startWithToken:@"5534212f4a44f477c9ab270ab5cd2062" invocationEvent:IBGInvocationEventShake]; +#endif return YES; } diff --git a/src/status_im/ios/core.cljs b/src/status_im/ios/core.cljs index 2becd7b5c1..75d1b09dbf 100644 --- a/src/status_im/ios/core.cljs +++ b/src/status_im/ios/core.cljs @@ -44,8 +44,7 @@ [taoensso.timbre :as log] [status-im.chat.styles.screen :as st] [status-im.profile.qr-code.screen :refer [qr-code-view]] - [status-im.components.status :as status] - [status-im.utils.instabug :as instabug])) + [status-im.components.status :as status])) (defn orientation->keyword [o] (keyword (.toLowerCase o))) @@ -141,7 +140,6 @@ [component])]])]))))}))) (defn init [] - (instabug/init-instabug) (status/call-module status/init-jail) (dispatch-sync [:reset-app]) (dispatch [:listen-to-network-status!]) diff --git a/src/status_im/utils/handlers.cljs b/src/status_im/utils/handlers.cljs index 08c66bad72..e8297352c1 100644 --- a/src/status_im/utils/handlers.cljs +++ b/src/status_im/utils/handlers.cljs @@ -1,7 +1,7 @@ (ns status-im.utils.handlers (:require [re-frame.core :refer [after dispatch debug] :as re-core] - [re-frame.utils :refer [log]] - [clojure.string :as str])) + [clojure.string :as str] + [taoensso.timbre :as log])) (defn side-effect! "Middleware for handlers that will not affect db." @@ -17,7 +17,7 @@ [handler] (fn debug-handler [db v] - (log "Handling re-frame event: " (first v)) + (log/debug "Handling re-frame event: " (first v)) (let [new-db (handler db v)] new-db))) diff --git a/src/status_im/utils/instabug.cljs b/src/status_im/utils/instabug.cljs index dbd920a3b4..c757154c1a 100644 --- a/src/status_im/utils/instabug.cljs +++ b/src/status_im/utils/instabug.cljs @@ -3,13 +3,21 @@ (def instabug-rn (js/require "instabug-reactnative")) -(defn init-instabug [] - (when-not js/goog.DEBUG - (.startWithToken instabug-rn - "b239f82a9cb00464e4c72cc703e6821e" - (.. instabug-rn -invocationEvent -shake)))) - (defn log [str] (if js/goog.DEBUG (log/debug str) (.IBGLog instabug-rn str))) + +(defn instabug-appender [] + {:enabled? true + :async? false + :min-level nil + :rate-limit nil + :output-fn :inherit + + :fn (fn [data] + (let [{:keys [level ?ns-str ?err output_]} data] + (log (force output_))))}) + +(when-not js/goog.DEBUG + (log/merge-config! {:appenders {:instabug (instabug-appender)}}))