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 <[email protected]> * Add s prefix for global variables Signed-off-by: Youngho Yoon <[email protected]> * 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 <[email protected]> * Return logRedirectCallback when env is nullptr Signed-off-by: Youngho Yoon <[email protected]> * Use JniLocalReferenceScope instead of DeleteLocalRef Signed-off-by: Youngho Yoon <[email protected]> * Change type of global ref to JniGlobalReference Signed-off-by: Youngho Yoon <[email protected]> * Use CharToStringUTF instead of NewStringUTF Signed-off-by: Youngho Yoon <[email protected]> * Use VerifyOrReturn for CharToStringUTF Signed-off-by: Youngho Yoon <[email protected]> --------- Signed-off-by: Youngho Yoon <[email protected]>
- Loading branch information