Class SerilogLogger
Implements MS ILogger on top of Serilog.
Inheritance
Namespace: Umbraco.Cms.Core.Logging.Serilog
Assembly: Umbraco.Infrastructure.dll
Syntax
public class SerilogLogger
Constructors
View SourceSerilogLogger(LoggerConfiguration)
Initializes a new instance of the SerilogLogger class with the specified Serilog.LoggerConfiguration.
Declaration
public SerilogLogger(LoggerConfiguration logConfig)
Parameters
| Type | Name | Description |
|---|---|---|
| LoggerConfiguration | logConfig | The Serilog.LoggerConfiguration to configure the Serilog logger. |
Properties
View SourceSerilogLog
Gets the underlying Serilog Serilog.ILogger instance used for logging.
Declaration
public ILogger SerilogLog { get; }
Property Value
| Type | Description |
|---|---|
| ILogger |
Methods
View SourceDebug(Type, string)
Logs a debug-level message using the logger associated with the specified reporting type.
Declaration
public void Debug(Type reporting, string message)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The System.Type that is reporting the debug message. |
| string | message | The debug message to log. |
Debug(Type, string, params object[])
Logs a debug-level message for the specified reporting type using a message template and optional property values.
Declaration
public void Debug(Type reporting, string messageTemplate, params object[] propertyValues)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The System.Type that is reporting the log message. |
| string | messageTemplate | A message template describing the log message, which can include placeholders for property values. |
| object[] | propertyValues | An optional array of property values to format the message template. |
Dispose()
Releases all resources used by the SerilogLogger by disposing the underlying Serilog logger instance.
Declaration
public void Dispose()
Error(Type, Exception)
Logs an error message and exception for the specified reporting component type.
Declaration
public void Error(Type reporting, Exception exception)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The System.Type representing the component reporting the error. |
| Exception | exception | The System.Exception instance to log. |
Error(Type, Exception, string)
Logs an error message and exception for the specified reporting type.
Declaration
public void Error(Type reporting, Exception exception, string message)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The System.Type of the component reporting the error. |
| Exception | exception | The System.Exception to log. |
| string | message | The error message to log. |
Error(Type, Exception, string, params object[])
Logs an error message for the specified reporting type, including an associated exception and optional structured property values for message template formatting.
Declaration
public void Error(Type reporting, Exception exception, string messageTemplate, params object[] propertyValues)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The System.Type that is reporting the error. |
| Exception | exception | The System.Exception to log. |
| string | messageTemplate | A message template describing the error, which may include placeholders for property values. |
| object[] | propertyValues | An array of objects to format the message template. |
Error(Type, string)
Logs an error message for the specified reporting type without an associated exception.
Declaration
public void Error(Type reporting, string message)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The System.Type (usually the calling class) that is reporting the error. |
| string | message | The error message to log. |
Error(Type, string, params object[])
Logs an error message for the specified reporting type, including an exception and a message.
Declaration
public void Error(Type reporting, string messageTemplate, params object[] propertyValues)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The System.Type that is reporting the error. |
| string | messageTemplate | A message template describing the error, which may include placeholders for property values. |
| object[] | propertyValues | An array of objects to format the message template. |
Fatal(Type, Exception)
Logs a fatal error message and exception for the specified reporting type.
Declaration
public void Fatal(Type reporting, Exception exception)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The type on whose behalf the fatal error is being logged. |
| Exception | exception | The exception associated with the fatal error. |
Fatal(Type, Exception, string)
Logs a fatal error message and exception for the specified reporting type.
Declaration
public void Fatal(Type reporting, Exception exception, string message)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The type on whose behalf the fatal error is being logged. |
| Exception | exception | The exception associated with the fatal error. |
| string | message | The message describing the fatal error. |
Fatal(Type, Exception, string, params object[])
Logs a fatal error message for the specified reporting type, including an exception and a formatted message template.
Declaration
public void Fatal(Type reporting, Exception exception, string messageTemplate, params object[] propertyValues)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The System.Type that is reporting the fatal error. |
| Exception | exception | The System.Exception associated with the fatal error. |
| string | messageTemplate | A message template describing the fatal error, which can include placeholders for property values. |
| object[] | propertyValues | An array of property values to format the message template. |
Fatal(Type, string)
Logs a fatal error message using the specified reporting type.
Declaration
public void Fatal(Type reporting, string message)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The System.Type that is reporting the fatal error. |
| string | message | The fatal error message to log. |
Fatal(Type, string, params object[])
Logs a fatal error message for the specified reporting type using the provided message template and property values.
Declaration
public void Fatal(Type reporting, string messageTemplate, params object[] propertyValues)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The System.Type that is reporting the fatal error. |
| string | messageTemplate | A message template describing the fatal error, which can include placeholders for property values. |
| object[] | propertyValues | An array of property values to format into the message template. |
Info(Type, string)
Logs a message at the Information level for the specified reporting type.
Declaration
public void Info(Type reporting, string message)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The System.Type whose logger will be used to log the message. |
| string | message | The informational message to log. |
Info(Type, string, params object[])
Logs an informational message for the specified reporting type using a message template and optional property values.
Declaration
public void Info(Type reporting, string messageTemplate, params object[] propertyValues)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The System.Type that is reporting the log message. |
| string | messageTemplate | A message template describing the log message, which can include placeholders for property values. |
| object[] | propertyValues | An array of objects to format into the message template placeholders. |
IsEnabled(Type, LogLevel)
Determines whether logging is enabled for the specified reporting type and log level.
Declaration
public bool IsEnabled(Type reporting, LogLevel level)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The type that is reporting the log message. |
| LogLevel | level | The level of the log message. |
Returns
| Type | Description |
|---|---|
| bool |
|
Verbose(Type, string)
Logs a verbose-level message for the specified reporting type.
Declaration
public void Verbose(Type reporting, string message)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The System.Type that is reporting the message. |
| string | message | The verbose message to log. |
Verbose(Type, string, params object[])
Logs a verbose-level message for the specified reporting type using a message template and optional property values.
Declaration
public void Verbose(Type reporting, string messageTemplate, params object[] propertyValues)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The System.Type that is reporting the log message. |
| string | messageTemplate | A message template describing the log message, which can include placeholders for property values. |
| object[] | propertyValues | An optional array of property values to format the message template. |
Warn(Type, Exception, string)
Logs a warning message and exception for the specified reporting type.
Declaration
public void Warn(Type reporting, Exception exception, string message)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The type that is issuing the warning. |
| Exception | exception | The exception to log with the warning message. |
| string | message | The warning message to log. |
Warn(Type, Exception, string, params object[])
Logs a warning message for the specified reporting type, including an exception and a formatted message template.
Declaration
public void Warn(Type reporting, Exception exception, string messageTemplate, params object[] propertyValues)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The System.Type that is reporting the warning. |
| Exception | exception | The System.Exception associated with the warning. |
| string | messageTemplate | A message template describing the warning, which can include placeholders for formatting. |
| object[] | propertyValues | An array of objects to format the message template. |
Warn(Type, string)
Logs a warning message for the specified reporting type.
Declaration
public void Warn(Type reporting, string message)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The type that is issuing the warning. |
| string | message | The warning message to log. |
Warn(Type, string, params object[])
Logs a warning message for the specified reporting type.
Declaration
public void Warn(Type reporting, string message, params object[] propertyValues)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | reporting | The System.Type that is reporting the warning. |
| string | message | The warning message to log. May contain format placeholders for property values. |
| object[] | propertyValues | Optional property values to format into the message. |