blob: 49213b50eaa07c8a90c1f6daa7915652d1d260ee (
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 Vespa.ai. 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(Level.WARNING, String.format("%s: %s", traceDescription.getDescription(),
traceDescription.getTrace().toString()));
}
}
}
|