Skip to content

Commit

Permalink
#188590455 1.1.7 (#16)
Browse files Browse the repository at this point in the history
* 1.1.7

Add a debug MoesifApiConnConfig field. If set, it logs the config object upon interceptor initialization

Small doc updates

Clean up some static member access warnings

* debug is false by default
  • Loading branch information
bakennedy authored Nov 20, 2024
1 parent c520546 commit a46a384
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 12 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ For Maven users, add dependency to your `pom.xml`:
<dependency>
<groupId>com.moesif</groupId>
<artifactId>moesif-okhttp-interceptor</artifactId>
<version>1.1.1</version>
<version>1.1.6</version>
</dependency>
```
For Gradle users, add to your project's build.gradle file:

```gradle
repositories {
dependencies {
implementation 'com.moesif:moesif-okhttp-interceptor:1.1.1'
implementation 'com.moesif:moesif-okhttp-interceptor:1.1.6'
}
```

Expand Down Expand Up @@ -179,6 +179,7 @@ To use this custom config, update it prior to constructing the interceptor
```java
MoesifApiConnConfig cfg = new MoesifApiConnConfig();
cfg.setEventFilterConfig(new MyCustomEventFilterConfig());
cfg.setDebug(false);
MoesifOkHttp3Interceptor interceptor = new MoesifOkHttp3Interceptor(cfg);
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.moesif</groupId>
<artifactId>moesif-okhttp-interceptor</artifactId>
<version>1.1.6</version>
<version>1.1.7</version>
<packaging>jar</packaging>
<name>moesif-okhttp-interceptor</name>
<url>https://www.moesif.com</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,15 @@ public MoesifOkHttp3Interceptor(MoesifApiConnConfig connConfig) {
}

public void init(MoesifApiConnConfig connConfig) {
this.connConfig = (null == connConfig)
MoesifOkHttp3Interceptor.connConfig = (null == connConfig)
? new MoesifApiConnConfig() : connConfig;
if (getConnConfig().isDebug()) {
logger.debug("MoesifOkHttp3Interceptor initialized with config: {}", getConnConfig());
}
}

public MoesifApiConnConfig getConnConfig(){
return this.connConfig;
return connConfig;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,14 @@

public class MoesifApiConnConfig {
public static String DEFAULT_BASE_URI = "https://api.moesif.net";
public String baseUri;

public String baseUri;
public Integer eventsBufferSize = 5;
private IInterceptEventFilter eventFilterConfig;


public Collection<String> bodyContentTypesBlackList =
DefaultDomainData.bodyContentTypesBlackList;

public Collection<String> bodyContentTypesBlackList = DefaultDomainData.bodyContentTypesBlackList;

private String applicationId;
private IInterceptEventFilter eventFilterConfig;
private boolean debug;

public MoesifApiConnConfig() {
init(null, null);
Expand All @@ -30,6 +27,7 @@ public MoesifApiConnConfig() {
public MoesifApiConnConfig(String moesifApplicationId) {
init(moesifApplicationId, null);
}

public MoesifApiConnConfig(String applicationId, String baseUri) {
init(applicationId, baseUri);
}
Expand Down Expand Up @@ -142,4 +140,23 @@ public void setEventFilterConfig(IInterceptEventFilter eventFilterConfig) {
: eventFilterConfig;
}

public boolean isDebug() {
return debug;
}

public void setDebug(boolean debug) {
this.debug = debug;
}

@Override
public String toString() { // produce a log friendly single-line string representation of the config
return "MoesifApiConnConfig{" +
"baseUri='" + baseUri + '\'' +
", eventsBufferSize=" + eventsBufferSize +
", eventFilterConfig=" + eventFilterConfig +
", bodyContentTypesBlackList=" + bodyContentTypesBlackList +
", applicationId='" + applicationId + '\'' +
", debug=" + debug +
'}';
}
}

0 comments on commit a46a384

Please sign in to comment.