Log signals from the Clojure layer instead of native code (#19683)

We log the entire signal data when it arrives from status-go in the native
layer, where our Clojure logging mechanism is unavailable. Sometimes, the
developer may not want that much noise during development, e.g. when managing
integration or contract tests.

This commit removes the native calls to log signals and adds a timbre
(log/debug ...) call in the event handler :signals/signal-received. We know
timbre will elide log calls at compile time given the minimum log level set,
therefore, we don't need to worry about performance because we will log signals
at the debug level only.
This commit is contained in:
Icaro Motta 2024-04-23 09:53:07 -03:00 committed by GitHub
parent 696fedcca2
commit 01a503f3bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 1 additions and 6 deletions

View File

@ -43,7 +43,6 @@ class StatusModule(private val reactContext: ReactApplicationContext, private va
}
override fun handleSignal(jsonEventString: String) {
Log.d(TAG, "Signal event")
val params = Arguments.createMap()
params.putString("jsonEvent", jsonEventString)
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java).emit("gethEvent", params)

View File

@ -38,9 +38,6 @@ static RCTBridge *bridge;
return;
}
#if DEBUG
NSLog(@"[handleSignal] Received an event from Status-Go: %@", signal);
#endif
[bridge.eventDispatcher sendAppEventWithName:@"gethEvent"
body:@{@"jsonEvent": signal}];

View File

@ -1128,8 +1128,6 @@ Persistent<Function> r_call;
std::queue<std::string> q;
void run(char *json) {
printf("signal received %s\n", json);
std::string str(json);
q.push(str);
}

View File

@ -35,6 +35,7 @@
(let [^js data (.parse js/JSON event-str)
^js event-js (.-event data)
type (.-type data)]
(log/debug "Signal received" event-str)
(case type
"node.login" {:fx [[:dispatch
[:profile.login/login-node-signal