Package io.opentelemetry.sdk.logs.export
Class MultiLogRecordExporter
- java.lang.Object
-
- io.opentelemetry.sdk.logs.export.MultiLogRecordExporter
-
- All Implemented Interfaces:
LogRecordExporter,java.io.Closeable,java.lang.AutoCloseable
final class MultiLogRecordExporter extends java.lang.Object implements LogRecordExporter
LogRecordExporterthat forwards all received logs to a list ofLogRecordExporter.Can be used to export to multiple backends using the same
LogRecordExporterlike aSimpleLogRecordProcessoror aBatchLogRecordProcessor.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.logging.Loggerloggerprivate LogRecordExporter[]logRecordExporters
-
Constructor Summary
Constructors Modifier Constructor Description privateMultiLogRecordExporter(LogRecordExporter[] logRecordExporters)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static LogRecordExportercreate(java.util.List<LogRecordExporter> logRecordExporters)Constructs and returns an instance of this class.CompletableResultCodeexport(java.util.Collection<LogRecordData> logs)Exports the collections of givenLogRecordData.CompletableResultCodeflush()Flushes the data of all registeredLogRecordExporters.CompletableResultCodeshutdown()Shutdown the log exporter.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.opentelemetry.sdk.logs.export.LogRecordExporter
close
-
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
logRecordExporters
private final LogRecordExporter[] logRecordExporters
-
-
Constructor Detail
-
MultiLogRecordExporter
private MultiLogRecordExporter(LogRecordExporter[] logRecordExporters)
-
-
Method Detail
-
create
static LogRecordExporter create(java.util.List<LogRecordExporter> logRecordExporters)
Constructs and returns an instance of this class.- Parameters:
logRecordExporters- the exporters logs should be sent to- Returns:
- the aggregate log exporter
-
export
public CompletableResultCode export(java.util.Collection<LogRecordData> logs)
Description copied from interface:LogRecordExporterExports the collections of givenLogRecordData.- Specified by:
exportin interfaceLogRecordExporter- Parameters:
logs- the collection ofLogRecordDatato be exported- Returns:
- the result of the export, which is often an asynchronous operation
-
flush
public CompletableResultCode flush()
Flushes the data of all registeredLogRecordExporters.- Specified by:
flushin interfaceLogRecordExporter- Returns:
- the result of the operation
-
shutdown
public CompletableResultCode shutdown()
Description copied from interface:LogRecordExporterShutdown the log exporter. Called whenSdkLoggerProvider.shutdown()is called when this exporter is registered to the provider viaBatchLogRecordProcessororSimpleLogRecordProcessor.- Specified by:
shutdownin interfaceLogRecordExporter- Returns:
- a
CompletableResultCodewhich is completed when shutdown completes
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-