mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-04-05 10:05:39 +02:00
* removed $ from code-blocks in build_all.sh * separate the code from the output * added shell indicator for the code block * added shell indicator for the code block * update logging.md * separate the code from the output in other files as well * update the output code-blocks to text
699 B
699 B
Logging
You should use the log
crate to automatically log to logcat
(on-device) or
stdout
(on-host):
hello_rust_logs/Android.bp:
{{#include logging/Android.bp}}
hello_rust_logs/src/main.rs:
{{#include logging/src/main.rs:main}}
Build, push, and run the binary on your device:
{{#include build_all.sh:hello_rust_logs}}
The logs show up in adb logcat
:
adb logcat -s rust
09-08 08:38:32.454 2420 2420 D rust: hello_rust_logs: Starting program.
09-08 08:38:32.454 2420 2420 I rust: hello_rust_logs: Things are going fine.
09-08 08:38:32.454 2420 2420 E rust: hello_rust_logs: Something went wrong!