Skip to content

Log Refactor #14087

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/src/main/java/org/signal/glide/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public interface Provider {
void w(@NonNull String tag, @NonNull String message);
void e(@NonNull String tag, @NonNull String message, @Nullable Throwable throwable);


Provider EMPTY = new Provider() {
@Override
public void v(@NonNull String tag, @NonNull String message) { }
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/java/org/signal/glide/transforms/LogMessage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.signal.glide.transforms;

public record LogMessage(String value) {
public LogMessage {
if (value == null || value.isBlank()) {
throw new IllegalArgumentException("LogMessage cannot be null or blank");
}
}
}
Comment on lines +1 to +9

Choose a reason for hiding this comment

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

I noticed that this PR introduces a new file in Java, while we're in the midst of migrating our codebase to Kotlin. Is there a particular reason we opted for Java here instead of Kotlin?
Would it be possible to implement this new functionality in Kotlin to maintain consistency with our migration efforts?

9 changes: 9 additions & 0 deletions app/src/main/java/org/signal/glide/transforms/LogTag.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.signal.glide.transforms;

public record LogTag(String value) {
public LogTag {
if (value == null || value.isBlank()) {
throw new IllegalArgumentException("LogTag cannot be null or blank");
}
}
}
Comment on lines +1 to +9

Choose a reason for hiding this comment

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

Same as above

10 changes: 10 additions & 0 deletions app/src/main/java/org/signal/glide/transforms/LoggingService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.signal.glide.transforms;

import androidx.annotation.Nullable;

public interface LoggingService {
void logDebug(LogTag tag, LogMessage message);
void logInfo(LogTag tag, LogMessage message);
void logWarn(LogTag tag, LogMessage message);
void logError(LogTag tag, LogMessage message, @Nullable Throwable throwable);
}
Comment on lines +1 to +10

Choose a reason for hiding this comment

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

Same as above