Class SinkConfiguration
SinkConfiguration stores all the data needed for Sink to work and what is most important - knows how to create and initialize the sink.
Inherited Members
Namespace: Unity.Logging.Sinks
Assembly: Unity.Logging.dll
Syntax
public abstract class SinkConfiguration
Constructors
SinkConfiguration(LoggerWriterConfig, FormatterStruct, bool?, LogLevel?, FixedString512Bytes?)
Base sink configuration constructor.
Declaration
protected SinkConfiguration(LoggerWriterConfig writeTo, FormatterStruct formatter, bool? captureStackTraceOverride = null, LogLevel? minLevelOverride = null, FixedString512Bytes? outputTemplateOverride = null)
Parameters
Type | Name | Description |
---|---|---|
LoggerWriterConfig | writeTo | Logger config |
FormatterStruct | formatter | Formatter that should be used by this sink. Text is default |
bool? | captureStackTraceOverride | True if stack traces should be captured. Null if common setting should be used |
LogLevel? | minLevelOverride | Minimal level of logs for this particular sink. Null if common level should be used |
FixedString512Bytes? | outputTemplateOverride | Output message template for this particular sink. Null if common template should be used |
Fields
CaptureStackTraces
True if this logger needs stack traces.
Declaration
public bool CaptureStackTraces
Field Value
Type | Description |
---|---|
bool |
LogFormatter
Formatter that controls how to represent the log message: plain text, json, etc..
Declaration
public FormatterStruct LogFormatter
Field Value
Type | Description |
---|---|
FormatterStruct |
MinLevel
Minimal level that sink will log.
Declaration
public LogLevel MinLevel
Field Value
Type | Description |
---|---|
LogLevel |
OutputTemplate
Output template for the message. Ignored in structured logging case.
Declaration
public FixedString512Bytes OutputTemplate
Field Value
Type | Description |
---|---|
FixedString512Bytes |
Methods
CreateAndInitializeSinkInstance<T>(Logger, SinkConfiguration)
Standard way of creation and init the sink
Declaration
public static T CreateAndInitializeSinkInstance<T>(Logger logger, SinkConfiguration configuration) where T : SinkSystemBase, new()
Parameters
Type | Name | Description |
---|---|---|
Logger | logger | Parent Logger |
SinkConfiguration | configuration | Configuration that stores all the data needed for the init |
Returns
Type | Description |
---|---|
T | Specific SinkSystemBase sink instance, already Initialized |
Type Parameters
Name | Description |
---|---|
T | SinkSystemBase |
CreateSinkInstance(Logger)
Function that creates specific SinkSystem using this configuration.
Declaration
public abstract SinkSystemBase CreateSinkInstance(Logger logger)
Parameters
Type | Name | Description |
---|---|---|
Logger | logger | Parent Logger |
Returns
Type | Description |
---|---|
SinkSystemBase | Specific SinkSystem that is going to be added to the Logger |