Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance Android Logging with setLogCallback API (#35254)
* Enhance Android Logging with setLogCallback API This change adds the setLogCallback API to the AndroidChipLogging class of the Matter SDK, enhancing its logging capabilities. With this API, developers can customize logging behavior and integrate it with Android's logging system, allowing for more flexible and comprehensive logging. An example of usage in Kotlin is as follows: ChipDeviceController.loadJni() AndroidChipLogging.setLogCallback { module, priority, message -> when (priority) { Log.ERROR -> Log.e(module, message) Log.INFO -> Log.i(module, message) Log.DEBUG -> Log.d(module, message) } } Signed-off-by: Youngho Yoon <34558998+yhoyoon@users.noreply.github.com> * Add s prefix for global variables Signed-off-by: Youngho Yoon <34558998+yhoyoon@users.noreply.github.com> * Do not call onLogMessage callback when msg is null Handle the case where jMsg is null due to UTF decode errors in buffer. Don't call the callback when the string is null. Signed-off-by: Youngho Yoon <34558998+yhoyoon@users.noreply.github.com> * Return logRedirectCallback when env is nullptr Signed-off-by: Youngho Yoon <34558998+yhoyoon@users.noreply.github.com> * Use JniLocalReferenceScope instead of DeleteLocalRef Signed-off-by: Youngho Yoon <34558998+yhoyoon@users.noreply.github.com> * Change type of global ref to JniGlobalReference Signed-off-by: Youngho Yoon <34558998+yhoyoon@users.noreply.github.com> * Use CharToStringUTF instead of NewStringUTF Signed-off-by: Youngho Yoon <34558998+yhoyoon@users.noreply.github.com> * Use VerifyOrReturn for CharToStringUTF Signed-off-by: Youngho Yoon <34558998+yhoyoon@users.noreply.github.com> --------- Signed-off-by: Youngho Yoon <34558998+yhoyoon@users.noreply.github.com>
- Loading branch information