Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a funtion to forge Android logd entry #13

Merged
merged 4 commits into from
Mar 6, 2024
Merged

Conversation

DimaWittmann
Copy link
Contributor

This PR adds a function that constructs a custom log entry.
I can be used it forge log entries, for example, to forward logs for 3rd party app to lodg

Copy link
Owner

@flxo flxo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution. Left some comments.

src/lib.rs Outdated
//! To forge android logd entry:
//!
//! ```
//! android_logd_logger::low(buffer_id, pid, thread_id, secs, subsec_nanos, tag, priority, message).unwrap();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a typo. Should be log. Can you please also ensure that rustdoc catches the examples and tries to build them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for suggestion. I checked with the rustdoc

src/lib.rs Outdated
crate::logd::log(&record);

#[cfg(not(target_os = "android"))]
println!("buffer: {:?}, tag: {:?}, message: {:?}", buffer_id, tag, message);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please forward the records in the not android case as well. This keeps the equals format.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, I was just not sure, I removed this conditional compilation

Remove the additional heavy dependency `chrono` by using
`std::time::SystemTime` instead of secs and subsecs.
@flxo flxo merged commit 1aa24ad into flxo:main Mar 6, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants