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
Syntax
public abstract class SinkConfiguration
Constructors
SinkConfiguration(LoggerWriterConfig, FormatterStruct, Nullable<Boolean>, Nullable<LogLevel>, Nullable<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 |
| Nullable<Boolean> | captureStackTraceOverride | True if stack traces should be captured. Null if common setting should be used |
| Nullable<LogLevel> | minLevelOverride | Minimal level of logs for this particular sink. Null if common level should be used |
| Nullable<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 |
|---|---|
| Boolean |
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 |