Skip to content

Android build has no logger: engine errors never reach logcat #27

Description

@dubadub

Context

The client crate logs through log / tracing macros, but the Android build of libcooklang_sync_client.so installs no logger, so nothing the engine says reaches logcat. run_download_once even sets CARGO_LOG=trace, which has no effect there. On iOS the app gets errors only through the thrown SyncError; on Android the same, and until cook-md/android-app-private#737 the app was masking that error as well. Diagnosing a 402 from the sync server on a device took a temporary log line in the app and a second run.

Proposal

  • Behind the ffi feature on Android targets, install android_logger once (for example in SyncContext::new() or a dedicated init_logging() export), at info by default and debug when a flag is set.
  • Log the request path and HTTP status on every non-2xx response in remote.rs, since these are what get folded into SyncError::Unknown("... failed with status: ...") and Check download failed: ....
  • Consider mirroring on iOS with oslog so both hosts get the same signal.

Why

Every failure in download_loop other than 401 and 402 is wrapped into SyncError::Unknown, including plain network errors, so without engine logs the host app cannot tell a server 5xx from a dropped connection.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions