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

sinks: android: handle when message is not loggable #2801

Merged
merged 1 commit into from
Jul 6, 2023

Conversation

lucasrangit
Copy link
Contributor

@lucasrangit lucasrangit commented Jul 5, 2023

Android logger (since API 30) checks the per-tag property log.tag.<tag> to determine if a log message is loggable. See https://developer.android.com/ndk/reference/group/logging#__android_log_is_loggable . For example, __android_log_buf_write for a VERBOSE message will call __android_log_is_loggable and return -EPERM if the log message will not be printed because log.tag.<tag> is set to INFO.

Instead of erroring with the following, the Android sink should handle -EPERM. It is not an error to disable a log via the run-time property.

[*** LOG ERROR #0001 ***] [2023-06-29 00:50:26] [logcat] logging to Android failed: Unknown error -1 [/path/to/file.cpp(123)]

Android logger (since API 30) checks the per-tag property `log.tag.<tag>` to determine if a log message is loggable. See https://developer.android.com/ndk/reference/group/logging#__android_log_is_loggable . For example, `__android_log_buf_write` for a VERBOSE message will call `__android_log_is_loggable` and return `-EPERM` if the log message will not be printed because `log.tag.<tag>` is set to `INFO`.

Instead of erroring with the following error message, the Android sink should handle `-EPERM`. It is not an error to disable a log via the run-time property.

```
[*** LOG ERROR gabime#1 ***] [2023-06-29 00:50:26] [logcat] logging to Android failed: Unknown error -1 [/path/to/file.cpp(123)]
```
@gabime gabime merged commit 01b3724 into gabime:v1.x Jul 6, 2023
10 checks passed
@gabime
Copy link
Owner

gabime commented Jul 6, 2023

Thanks @lucasrangit

@lucasrangit lucasrangit deleted the android-is-loggable branch July 7, 2023 06:58
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