Skip to content

Commit

Permalink
feat: support setter for logMode and logLevel (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhao900914 authored Aug 3, 2023
1 parent 38492ae commit d07f830
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/com/amplitude/AmplitudeLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ public void setLogMode(LogMode logMode) {
this.logMode = logMode;
}

public LogMode getLogMode() {
return this.logMode;
}

public void debug(String tag, String message) {
log(tag, message, LogMode.DEBUG);
}
Expand Down Expand Up @@ -40,5 +44,9 @@ public enum LogMode {
LogMode(int level) {
this.level = level;
}

public int getLogLevel() {
return this.level;
}
}
}
8 changes: 8 additions & 0 deletions src/test/java/com/amplitude/AmplitudeLogTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ public void restoreStreams() throws IOException {
System.setErr(originalErr);
}

@Test
public void testLogMode() {
AmplitudeLog.LogMode logMode = AmplitudeLog.LogMode.DEBUG;
amplitudeLog.setLogMode(logMode);
assertEquals(amplitudeLog.getLogMode(),logMode);
assertEquals(amplitudeLog.getLogMode().getLogLevel(),1);
}

@ParameterizedTest
@MethodSource("logArguments")
public void testLog(
Expand Down

0 comments on commit d07f830

Please sign in to comment.