New: Allow developers to enable Rust logs.

Rather than constantly uncommenting this line locally and rebuilding the SDK, allow a wallet to just turn logging on since it still takes a lot of hoops to even get a log to show up (a dev must add the log dependency to librustzcash, clone all the repos and add logs).
This commit is contained in:
Kevin Gorham 2021-07-29 13:23:45 -04:00
parent 92c951769d
commit 405a047717
No known key found for this signature in database
GPG Key ID: CCA55602DF49FC38
1 changed files with 12 additions and 1 deletions

View File

@ -233,11 +233,22 @@ class RustBackend private constructor() : RustBackendWelding {
if (!loaded) {
twig("Loading RustBackend") {
loadRustLibrary()
// initLogs()
}
}
}
/**
* Forwards Rust logs to logcat. This is a function that is intended for debug purposes. All
* logs will be tagged with `cash.z.rust.logs`. Typically, a developer would clone
* librustzcash locally and then modify Cargo.toml in this project to point to their local
* build (see Cargo.toml for details). From there, they can add any log messages they want
* and have them surfaced into the Android logging system. By default, this behavior is
* disabled and this is the function that enables it. Initially only the logs in
* [src/main/rust/lib.rs] will appear and any additional logs would need to be added by the
* developer.
*/
fun enableRustLogs() = initLogs()
/**
* The first call made to this object in order to load the Rust backend library. All other
* external function calls will fail if the libraries have not been loaded.