Skip to content

Commit

Permalink
Very minor cleanup to change the logging exporters to use string-inte…
Browse files Browse the repository at this point in the history
…rpolated logging. (#954)
  • Loading branch information
jkwatson authored Mar 2, 2020
1 parent 06dfd95 commit bd6c6fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io.opentelemetry.sdk.metrics.data.MetricData;
import io.opentelemetry.sdk.metrics.export.MetricExporter;
import java.util.Collection;
import java.util.logging.Level;
import java.util.logging.Logger;

public class LoggingMetricExporter implements MetricExporter {
Expand All @@ -28,7 +29,7 @@ public class LoggingMetricExporter implements MetricExporter {
public ResultCode export(Collection<MetricData> metrics) {
logger.info("Received a collection of " + metrics.size() + " metrics for export.");
for (MetricData metricData : metrics) {
logger.info("metric: " + metricData);
logger.log(Level.INFO, "metric: {0}", metricData);
}
return ResultCode.SUCCESS;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io.opentelemetry.sdk.trace.data.SpanData;
import io.opentelemetry.sdk.trace.export.SpanExporter;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/** A Span Exporter that logs every span at INFO level using java.util.logging. */
Expand All @@ -28,7 +29,7 @@ public class LoggingSpanExporter implements SpanExporter {
@Override
public ResultCode export(List<SpanData> spans) {
for (SpanData span : spans) {
logger.info("span: " + span);
logger.log(Level.INFO, "span: {0}", span);
}
return ResultCode.SUCCESS;
}
Expand Down

0 comments on commit bd6c6fc

Please sign in to comment.