logging to Instabug

This commit is contained in:
Roman Volosovskyi 2017-05-19 13:30:09 +03:00
parent 0deca1f874
commit e16b93fbd0
4 changed files with 22 additions and 12 deletions

View File

@ -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;
}

View File

@ -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!])

View File

@ -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)))

View File

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