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

rogcat as a library #16

Closed
tekjar opened this issue Apr 26, 2018 · 5 comments
Closed

rogcat as a library #16

tekjar opened this issue Apr 26, 2018 · 5 comments

Comments

@tekjar
Copy link

tekjar commented Apr 26, 2018

Hi. Is rogcat a wrapper over logcat binary or is it a port with more features? I want to write a log shipper for android. My service runs inside android and I need a way to read logs. Can rogcat be used for this purpose?

@flxo
Copy link
Owner

flxo commented Apr 26, 2018

Hi. rogcat is mainly a wrapper that provides convenience features that the plain logcat doesn't have. It not intended to be used as a library and probably not very portable because it has tons of dependencies. I'm not sure if I fully understand what a log shipper is. Do you want to read the buffers and send it somewhere? This basically running logcat and read it's stdout.

Is your service written in Rust? If yes you can get some inspiration:

If you need to parse the logcat format, have a look at the parser. For calling and capturing locats output see runner.rs.

The individual modules of rogcat are that small that it's not really been worth separating them into crates, but of course this is possible...

@tekjar
Copy link
Author

tekjar commented Apr 26, 2018

Do you want to read the buffers and send it somewhere?

Yeah

This basically running logcat and read it's stdout.

Yeah. But I'm not sure of the costs of reading output from logcat vs reading from buffers directly.

@flxo
Copy link
Owner

flxo commented Apr 26, 2018

Talking to logd directly is probably cheaper. See liblog and logcat. All the headers you need should be part of the NDK.
Otherwise just call logcat and capture. You may want to use the dump flag`.

@flxo
Copy link
Owner

flxo commented May 5, 2018

This seems to be clarified. @tekjar comment if you disagree. :-)

@flxo flxo closed this as completed May 5, 2018
@tekjar
Copy link
Author

tekjar commented May 8, 2018

You clarified my question. Thanks :)

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

No branches or pull requests

2 participants