googlesamples / mlkit

A collection of sample apps to demonstrate how to use Google's ML Kit APIs on Android and iOS
Apache License 2.0
3.51k stars 2.92k forks source link

[Feature request] Option to suppress translate logs #799

Open listvin opened 5 months ago

listvin commented 5 months ago

What's your feature request? Please describe. As title says, I need an option to disable excessive logging by MLKit translator. Currently it spits out every request with input, output and some technical data. Apart from cluttering, I see it as a security issue, since same behaviour is present in release builds. R8 tricks for log removal do not affect this, from my understanding because this logging comes from native code.

Mobile environment Android

Additional context Log sample for single query

2024-03-28 20:51:06.325 20528-24456 native                  org.example.app        I  I0000 00:00:1711651866.325752   24456 mergeddicttrans.cc:1741] 
                                                                                                    Source language: iw, target language: en

                                                                                                    Full translation: Laid a fingerprint to continue
                                                                                                    Translate Instance: 
                                                                                                    Query (raw): יש להניח טביעת אצבע להמשך
                                                                                                    Query (after preprocess): יש להניח טביעת אצבע להמשך
                                                                                                    Query ids (after tokenizer): 85 126 3122 172 173 303 2336 353 126 1988 2
                                                                                                    Translation ids: 35 1671 11 122 2356 444 679 7 2229 2
                                                                                                    Translation (after detokenizer): Laid a fingerprint to continue
                                                                                                    Alignment probability:
                                                                                                        Laid    a   fingerprint to  continue
                                                                                                    יש  0.123529    0.0627451   0.00294118  0.141176    0.00784314
                                                                                                    להניח   0.435294    0.0901961   0.00882353  0.0470588   0.0156863
                                                                                                    טביעת   0.0568627   0.25098 0.495098    0.0745098   0.0117647
                                                                                                    אצבע    0.160784    0.341176    0.398039    0.0156863   0.00784314
                                                                                                    להמשך   0.135294    0.117647    0.0578431   0.678431    0.862745
                                                                                                    Translation (before postprocess): Laid a fingerprint to continue
listvin commented 4 months ago

Hello, @zhouyiself ! Any thoughts?