Class SdkLoggerProviderBuilder
SdkLoggerProvider instances.- Since:
- 1.27.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Clockprivate ScopeConfiguratorBuilder<LoggerConfig> private final List<LogRecordProcessor> private Resource -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) SdkLoggerProviderBuilderaddLoggerConfiguratorCondition(Predicate<InstrumentationScopeInfo> scopeMatcher, LoggerConfig loggerConfig) Adds a condition to the logger configurator, which computesLoggerConfigfor eachInstrumentationScopeInfo.addLogRecordProcessor(LogRecordProcessor processor) Add a log processor.addResource(Resource resource) Merge aResourcewith the current.build()Create aSdkLoggerProviderinstance.Assign aClock.(package private) SdkLoggerProviderBuildersetLoggerConfigurator(ScopeConfigurator<LoggerConfig> loggerConfigurator) Set the logger configurator, which computesLoggerConfigfor eachInstrumentationScopeInfo.setLogLimits(Supplier<LogLimits> logLimitsSupplier) setResource(Resource resource) Assign aResourceto be attached to allLogRecordDatacreated byLoggers obtained from theSdkLoggerProvider.
-
Field Details
-
logRecordProcessors
-
resource
-
logLimitsSupplier
-
clock
-
loggerConfiguratorBuilder
-
-
Constructor Details
-
SdkLoggerProviderBuilder
SdkLoggerProviderBuilder()
-
-
Method Details
-
setResource
Assign aResourceto be attached to allLogRecordDatacreated byLoggers obtained from theSdkLoggerProvider.- Parameters:
resource- the resource- Returns:
- this
-
addResource
Merge aResourcewith the current.- Parameters:
resource-Resourceto merge with current.- Since:
- 1.29.0
-
setLogLimits
Assign aSupplierofLogLimits.LogLimitswill be retrieved each time aLogger.logRecordBuilder()is called.The
logLimitsSuppliermust be thread-safe and return immediately (no remote calls, as contention free as possible).- Parameters:
logLimitsSupplier- the supplier that will be used to retrieve theLogLimitsfor everyLogRecordBuilder.- Returns:
- this
-
addLogRecordProcessor
Add a log processor.LogRecordProcessor.onEmit(Context, ReadWriteLogRecord)will be called each time a log is emitted byLoggerinstances obtained from theSdkLoggerProvider.- Parameters:
processor- the log processor- Returns:
- this
-
setClock
Assign aClock.- Parameters:
clock- The clock to use for all temporal needs.- Returns:
- this
-
setLoggerConfigurator
Set the logger configurator, which computesLoggerConfigfor eachInstrumentationScopeInfo.This method is experimental so not public. You may reflectively call it using
SdkLoggerProviderUtil.setLoggerConfigurator(SdkLoggerProviderBuilder, ScopeConfigurator).Overrides any matchers added via
addLoggerConfiguratorCondition(Predicate, LoggerConfig).- See Also:
-
addLoggerConfiguratorCondition
SdkLoggerProviderBuilder addLoggerConfiguratorCondition(Predicate<InstrumentationScopeInfo> scopeMatcher, LoggerConfig loggerConfig) Adds a condition to the logger configurator, which computesLoggerConfigfor eachInstrumentationScopeInfo.This method is experimental so not public. You may reflectively call it using
SdkLoggerProviderUtil.addLoggerConfiguratorCondition(SdkLoggerProviderBuilder, Predicate, LoggerConfig).Applies after any previously added conditions.
If
setLoggerConfigurator(ScopeConfigurator)was previously called, this condition will only be applied if theFunction.apply(Object)returns null for the matchedInstrumentationScopeInfo(s).- See Also:
-
build
Create aSdkLoggerProviderinstance.- Returns:
- an instance configured with the provided options
-