- 
                Notifications
    
You must be signed in to change notification settings  - Fork 6
 
feat: Add configurable log level support to DevCycle Android SDK #254
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
feat: Add configurable log level support to DevCycle Android SDK #254
Conversation
        
          
                android-client-sdk/src/main/java/com/devcycle/sdk/android/api/DevCycleClient.kt
              
                Outdated
          
            Show resolved
            Hide resolved
        
      Co-authored-by: jonathan <[email protected]>
Co-authored-by: jonathan <[email protected]>
Co-authored-by: jonathan <[email protected]>
Co-authored-by: jonathan <[email protected]>
Co-authored-by: jonathan <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds configurable log level support to the DevCycle Android SDK, allowing developers to filter log output based on a minimum level.
- Implements 
minLogLevelandsetMinLogLevel()inDevCycleLoggerwith thread-safe filtering logic. - Extends 
DevCycleOptionsto include a nullablelogLevelbuilder option. - Updates 
DevCycleClientinitialization to determine an effective log level (options vs. builder) and start the logger accordingly. 
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description | 
|---|---|
| android-client-sdk/src/main/java/com/devcycle/sdk/android/util/DevCycleLogger.kt | Added minLogLevel filtering and updated isLoggable implementation | 
| android-client-sdk/src/main/java/com/devcycle/sdk/android/api/DevCycleOptions.kt | Added nullable logLevel property and builder method | 
| android-client-sdk/src/main/java/com/devcycle/sdk/android/api/DevCycleClient.kt | Calculates effective log level, sets logger, and conditionally starts it | 
| android-client-sdk/src/test/java/com/devcycle/sdk/android/util/DevCycleLoggerTests.kt | New tests for log level filtering, NO_LOGGING behavior, and setter | 
Comments suppressed due to low confidence (3)
android-client-sdk/src/main/java/com/devcycle/sdk/android/api/DevCycleClient.kt:635
- There is no test covering the precedence and selection logic between options.logLevel and builder logLevel. Consider adding a unit test that sets both values and verifies that the more verbose (lower) level is chosen correctly.
 
            val effectiveLogLevel = listOfNotNull(options?.logLevel, logLevel).minByOrNull { it.value } ?: LogLevel.ERROR
android-client-sdk/src/main/java/com/devcycle/sdk/android/util/DevCycleLogger.kt:142
- The KDoc for this method mentions filtering by 
tag, but thetagparameter is not used in the logic. Update the comment to reflect that tag-based filtering is currently unsupported or implement tag filtering if intended. 
    protected open fun isLoggable(tag: String?, priority: Int): Boolean {
android-client-sdk/src/main/java/com/devcycle/sdk/android/api/DevCycleOptions.kt:16
- [nitpick] The 
logLevelproperty is nullable, which may require consumers to understand fallback behavior. Consider making it non-null with a default (e.g.,ERROR) or document the null fallback in the class KDoc for clearer API usage. 
    val logLevel: LogLevel?
Co-authored-by: jonathan <[email protected]>
f708f3d    to
    a43313f      
    Compare
  
    
Implements configurable log level functionality, allowing developers to control logging verbosity in the DevCycle Android SDK.
Changes
Core Implementation
DevCycleLogger.kt: Added log level filtering with
minLogLevelproperty andsetMinLogLevel()methodisLoggable()logic to filter messages based on minimum log level@VolatilepropertyDevCycleOptions.kt: Added
logLevelconfiguration optionlogLevel()builder method for setting log level in optionsDevCycleClient.kt: Updated client initialization to respect log level configuration
logLeveltakes precedence over builderlogLevelNO_LOGGINGTesting
setMinLogLevel()updates correctly