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

fix: turn off camerax info logs #1325

Merged

Conversation

navaronbracke
Copy link
Collaborator

This PR turns off the CameraX logging for the Log.DEBUG, Log.INFO and Log.WARN logging.
Per the docs of CameraX:

For apps that want to reduce the logs produced by CameraX, set it to Log. ERROR to avoid all logs except for error.

We could technically also allow Log.WARN, but I'm not sure if that is going to help much.

Fixes #1255

// This prevents the informational log spam from CameraX.
private fun configureCameraProcessProvider() {
try {
val config = CameraXConfig.Builder.fromConfig(Camera2Config.defaultConfig()).apply {
Copy link
Collaborator Author

@navaronbracke navaronbracke Feb 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This uses the default Camera2 config and extends it with the override for logging level.

Per the docs in https://developer.android.com/reference/androidx/camera/lifecycle/ProcessCameraProvider#configureInstance(androidx.camera.core.CameraXConfig)

we can only do this once, though, since it is a singleton.

@@ -42,7 +45,6 @@ import dev.steenbakker.mobile_scanner.utils.serialize
import io.flutter.view.TextureRegistry
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.coroutineScope
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import

@@ -55,5 +55,8 @@ jobs:
- uses: subosito/flutter-action@v2
with:
cache: true
# TODO: move the code to the new tall style once Flutter 3.29 is the new minimum.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formatting action is using the latest stable Flutter version, 3.29.0.
That opts us into Dart 3.7 which includes new tall-style formatting.

@navaronbracke navaronbracke merged commit 63095d6 into juliansteenbakker:develop Feb 13, 2025
4 checks passed
@navaronbracke navaronbracke deleted the camerax_logging branch February 13, 2025 11:31
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.

How to disable/decrease noisy logs
1 participant