set log level from .env configuration

This commit is contained in:
Roman Volosovskyi 2017-11-14 16:18:15 +01:00
parent 777c9d04bc
commit 3d89143d72
7 changed files with 30 additions and 11 deletions

1
.env
View File

@ -4,3 +4,4 @@ DEBUG_LOGS_ENABLED=1
STUB_STATUS_GO=0
ETHEREUM_DEV_CLUSTER=1
MAINNET_NETWORKS_ENABLED=1
LOG_LEVEL=debug

View File

@ -4,3 +4,4 @@ DEBUG_LOGS_ENABLED=1
STUB_STATUS_GO=0
ETHEREUM_DEV_CLUSTER=1
MAINNET_NETWORKS_ENABLED=1
LOG_LEVEL=debug

View File

@ -4,3 +4,4 @@ DEBUG_LOGS_ENABLED=0
STUB_STATUS_GO=0
ETHEREUM_DEV_CLUSTER=0
MAINNET_NETWORKS_ENABLED=0
LOG_LEVEL=info

View File

@ -12,7 +12,8 @@
[status-im.utils.error-handler :as error-handler]
[status-im.utils.utils :as utils]
[status-im.utils.config :as config]
[status-im.utils.notifications :as notifications]))
[status-im.utils.notifications :as notifications]
[status-im.core :as core]))
(defn init-back-button-handler! []
(let [new-listener (fn []
@ -79,9 +80,6 @@
:reagent-render views/main})))
(defn init []
(error-handler/register-exception-handler!)
(status/init-jail)
(.registerComponent react/app-registry "StatusIm" #(reagent/reactify-component app-root))
(status/set-soft-input-mode status/adjust-resize)
(init-back-button-handler!)
(dispatch-sync [:initialize-app]))
(core/init app-root))

15
src/status_im/core.cljs Normal file
View File

@ -0,0 +1,15 @@
(ns status-im.core
(:require [status-im.utils.error-handler :as error-handler]
[status-im.ui.components.react :as react]
[re-frame.core :as re-frame]
[reagent.core :as reagent]
[status-im.native-module.core :as status]
[taoensso.timbre :as log]
[status-im.utils.config :as config]))
(defn init [app-root]
(log/set-level! config/log-level)
(error-handler/register-exception-handler!)
(status/init-jail)
(.registerComponent react/app-registry "StatusIm" #(reagent/reactify-component app-root))
(re-frame/dispatch-sync [:initialize-app]))

View File

@ -12,7 +12,8 @@
[status-im.utils.error-handler :as error-handler]
[status-im.utils.utils :as utils]
[status-im.utils.config :as config]
[status-im.utils.notifications :as notifications]))
[status-im.utils.notifications :as notifications]
[status-im.core :as core]))
(defn orientation->keyword [o]
(keyword (.toLowerCase o)))
@ -53,7 +54,4 @@
:reagent-render views/main})))
(defn init []
(error-handler/register-exception-handler!)
(status/init-jail)
(.registerComponent react/app-registry "StatusIm" #(reagent/reactify-component app-root))
(dispatch-sync [:initialize-app]))
(core/init app-root))

View File

@ -1,5 +1,6 @@
(ns status-im.utils.config
(:require [status-im.react-native.js-dependencies :as rn-dependencies]))
(:require [status-im.react-native.js-dependencies :as rn-dependencies]
[clojure.string :as string]))
(def config (js->clj (.-default rn-dependencies/config) :keywordize-keys true))
@ -20,4 +21,8 @@
(def notifications-wip-enabled? (enabled? (get-config :NOTIFICATIONS_WIP_ENABLED 0)))
(def stub-status-go? (enabled? (get-config :STUB_STATUS_GO 0)))
(def mainnet-networks-enabled? (enabled? (get-config :MAINNET_NETWORKS_ENABLED 0)))
(def log-level
(-> (get-config :LOG_LEVEL "error")
string/lower-case
keyword))