blob: e9de02b243b449a8664065d499eef5c5d303d195 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.streamingvisitors.tracing;
import java.util.logging.Level;
import java.util.function.Supplier;
import java.util.logging.Logger;
/**
* Trace exporter which dumps traces and their description as warning-entries in the Vespa log.
*/
public class LoggingTraceExporter implements TraceExporter {
private static final Logger log = Logger.getLogger(LoggingTraceExporter.class.getName());
@Override
public void maybeExport(Supplier<TraceDescription> traceDescriptionSupplier) {
var traceDescription = traceDescriptionSupplier.get();
if (traceDescription.getTrace() != null) {
log.log(LogLevel.WARNING, String.format("%s: %s", traceDescription.getDescription(),
traceDescription.getTrace().toString()));
}
}
}
|