Skip to content

Commit

Permalink
Correcting logging
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed Mar 4, 2019
1 parent fd0a82a commit 4914eac
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,21 @@ public GitLabCommentsProvider(
final String secretToken = null;
this.gitLabApi = new GitLabApi(hostUrl, tokenType, apiToken, secretToken, proxyConfig);
gitLabApi.setIgnoreCertificateErrors(api.isIgnoreCertificateErrors());
gitLabApi.enableRequestResponseLogging(Level.INFO);
gitLabApi.withRequestResponseLogging(
new Logger(GitLabCommentsProvider.class.getName(), null) {
@Override
public void log(final LogRecord record) {
final String masked =
String masked =
record
.getMessage() //
.replace(apiToken, MASK) //
.replace(api.findProxyPassword().orElse(""), MASK);
.replace(apiToken, MASK);
if (api.findProxyPassword().isPresent()) {
masked = masked.replace(api.findProxyPassword().get(), MASK);
}
violationsLogger.log(record.getLevel(), masked);
}
},
Level.FINE);
Level.INFO);

final String projectId = api.getProjectId();
try {
Expand Down

0 comments on commit 4914eac

Please sign in to comment.