Skip to content

Conversation

gpunto
Copy link
Contributor

@gpunto gpunto commented Sep 4, 2025

Goal

Allow clients to pass a custom logger & decide the http logging level.

Implementation

Introduce LoggingConfig that clients can use to pass a custom logger & the logging level. By default, we use core's Android logging & basic http logging.

Testing

Modify the sample app to pass a custom logger and verify it's called.

Checklist

  • Issue linked (if any)
  • Tests/docs updated
  • I have signed the Stream CLA (required for external contributors)

Copy link
Contributor

github-actions bot commented Sep 4, 2025

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled.

🎉 Great job! This PR is ready for review.

Copy link
Contributor

github-actions bot commented Sep 4, 2025

SDK Size Comparison 📏

SDK Before After Difference Status
stream-feeds-android-client 2.41 MB 2.41 MB 0.00 MB 🟢

@gpunto gpunto force-pushed the feat/logging-config branch from 7ea9701 to 0e6d823 Compare September 4, 2025 12:57
@gpunto gpunto added the pr:new-feature New feature label Sep 4, 2025
@gpunto gpunto requested a review from Copilot September 4, 2025 13:11
Copy link

@Copilot Copilot AI left a 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 introduces configurable logging for the Stream Feeds Android client, allowing clients to provide custom loggers and configure HTTP logging levels.

  • Adds LoggingConfig class to configure custom logger and HTTP logging level
  • Creates logger abstraction with Logger interface and level enum
  • Implements custom logger provider that bridges to core Android logging
  • Updates sample app to demonstrate custom logging configuration

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
FeedsConfig.kt Adds loggingConfig parameter with default configuration
LoggingConfig.kt New configuration class for logging settings
Logger.kt New logger interface with level enum for custom implementations
HttpLoggingLevel.kt New enum mapping HTTP logging levels to OkHttp interceptor levels
CustomLoggerProvider.kt Implementation bridging custom logger to core logging system
LoggingFactory.kt Factory functions for creating logger providers and HTTP interceptors
Create.kt Updates client creation to use configurable logging instead of hardcoded settings
CustomLoggerProviderTest.kt Test coverage for custom logger provider functionality
LoginManager.kt Sample app demonstrates custom logging configuration
Comments suppressed due to low confidence (1)

stream-feeds-android-client/src/main/kotlin/io/getstream/feeds/android/client/internal/client/Create.kt:1

  • The import okhttp3.logging.HttpLoggingInterceptor is removed but the functionality is now handled by the factory function. This is good cleanup as the direct usage has been abstracted away.
/*

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@gpunto gpunto marked this pull request as ready for review September 4, 2025 13:23
package io.getstream.feeds.android.client.api.logging

/** A logger interface for logging messages at different levels. */
public interface Logger {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I assume it is intentional that we don't expose the logger from core, but we use a Feeds-specific implementation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! I went for this because the core logger is marked as internal api, but if we prefer to expose StreamLoggerProvider & StreamLogger instead we definitely can. No strong opinion on my side.

If we do that, we should also evaluate the naming, because it could be a bit confusing from a client perspective that we have those, but also similarly-named code (e.g. StreamLogger) in the stream-log library.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see, thanks for the clarification! Let's keep it like this, as it would be easier to expose the core logger later if needed, rather than having to hide it afterwards.

@gpunto gpunto force-pushed the feat/logging-config branch from 0e6d823 to 1091432 Compare September 9, 2025 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:new-feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants