Class ProfilingLogger
Provides logging and profiling services.
Inheritance
Namespace: Umbraco.Cms.Core.Logging
Assembly: Umbraco.Core.dll
Syntax
public sealed class ProfilingLogger : IProfilingLogger
Constructors
View SourceProfilingLogger(ILogger, IProfiler)
Initializes a new instance of the ProfilingLogger class.
Declaration
public ProfilingLogger(ILogger logger, IProfiler profiler)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogger | logger | |
| IProfiler | profiler |
ProfilingLogger(ILogger<ProfilingLogger>, IProfiler)
Initializes a new instance of the ProfilingLogger class.
Declaration
public ProfilingLogger(ILogger<ProfilingLogger> logger, IProfiler profiler)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogger<ProfilingLogger> | logger | |
| IProfiler | profiler |
Properties
View SourceLogger
Gets the underlying Microsoft.Extensions.Logging.ILogger implementation.
Declaration
public ILogger Logger { get; }
Property Value
| Type | Description |
|---|---|
| ILogger |
Profiler
Gets the underlying IProfiler implementation.
Declaration
public IProfiler Profiler { get; }
Property Value
| Type | Description |
|---|---|
| IProfiler |
Methods
View SourceDebugDuration(Type, string, string, string?, int, object[]?, object[]?, object[]?)
Profiles an action and log as debug messages.
Declaration
public DisposableTimer? DebugDuration(Type loggerType, string startMessage, string completeMessage, string? failMessage = null, int thresholdMilliseconds = 0, object[]? startMessageArgs = null, object[]? endMessageArgs = null, object[]? failMessageArgs = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | loggerType | The type to use as the logger category. |
| string | startMessage | The message to log when the timer starts. |
| string | completeMessage | The message to log when the timer ends successfully. |
| string | failMessage | The message to log if the operation fails. |
| int | thresholdMilliseconds | Minimum elapsed time in milliseconds before logging the end message. |
| object[] | startMessageArgs | Arguments for the start message template. |
| object[] | endMessageArgs | Arguments for the end message template. |
| object[] | failMessageArgs | Arguments for the fail message template. |
Returns
| Type | Description |
|---|---|
| DisposableTimer | A DisposableTimer that logs completion when disposed, or |
DebugDuration<T>(string, object[]?)
Profiles an action and log as debug messages.
Declaration
public DisposableTimer? DebugDuration<T>(string startMessage, object[]? startMessageArgs = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | startMessage | The message to log when the timer starts. |
| object[] | startMessageArgs | Arguments for the start message template. |
Returns
| Type | Description |
|---|---|
| DisposableTimer | A DisposableTimer that logs completion when disposed, or |
Type Parameters
| Name | Description |
|---|---|
| T | The type to use as the logger category. |
DebugDuration<T>(string, string, string?, int, object[]?, object[]?, object[]?)
Profiles an action and log as debug messages.
Declaration
public DisposableTimer? DebugDuration<T>(string startMessage, string completeMessage, string? failMessage = null, int thresholdMilliseconds = 0, object[]? startMessageArgs = null, object[]? endMessageArgs = null, object[]? failMessageArgs = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | startMessage | The message to log when the timer starts. |
| string | completeMessage | The message to log when the timer ends successfully. |
| string | failMessage | The message to log if the operation fails. |
| int | thresholdMilliseconds | Minimum elapsed time in milliseconds before logging the end message. |
| object[] | startMessageArgs | Arguments for the start message template. |
| object[] | endMessageArgs | Arguments for the end message template. |
| object[] | failMessageArgs | Arguments for the fail message template. |
Returns
| Type | Description |
|---|---|
| DisposableTimer | A DisposableTimer that logs completion when disposed, or |
Type Parameters
| Name | Description |
|---|---|
| T | The type to use as the logger category. |
IsEnabled(LogLevel)
Checks if the given log level is enabled.
Declaration
public bool IsEnabled(LogLevel level)
Parameters
| Type | Name | Description |
|---|---|---|
| LogLevel | level | The log level to check. |
Returns
| Type | Description |
|---|---|
| bool |
|
IsEnabled(LogLevel)
Checks if the given logLevel is enabled.
Declaration
public bool IsEnabled(LogLevel logLevel)
Parameters
| Type | Name | Description |
|---|---|---|
| LogLevel | logLevel | Level to be checked. |
Returns
| Type | Description |
|---|---|
| bool |
|
LogCritical(Exception, string, params object[])
Logs a critical message with an exception.
Declaration
public void LogCritical(Exception exception, string messageTemplate, params object[] propertyValues)
Parameters
| Type | Name | Description |
|---|---|---|
| Exception | exception | The exception to log. |
| string | messageTemplate | The message template. |
| object[] | propertyValues | The property values to substitute into the template. |
LogCritical(string, params object[])
Logs a critical message.
Declaration
public void LogCritical(string messageTemplate, params object[] propertyValues)
Parameters
| Type | Name | Description |
|---|---|---|
| string | messageTemplate | The message template. |
| object[] | propertyValues | The property values to substitute into the template. |
LogDebug(string, params object[])
Logs a debug message.
Declaration
public void LogDebug(string messageTemplate, params object[] propertyValues)
Parameters
| Type | Name | Description |
|---|---|---|
| string | messageTemplate | The message template. |
| object[] | propertyValues | The property values to substitute into the template. |
LogError(Exception, string, params object[])
Logs an error message with an exception.
Declaration
public void LogError(Exception exception, string messageTemplate, params object[] propertyValues)
Parameters
| Type | Name | Description |
|---|---|---|
| Exception | exception | The exception to log. |
| string | messageTemplate | The message template. |
| object[] | propertyValues | The property values to substitute into the template. |
LogError(string, params object[])
Logs an error message.
Declaration
public void LogError(string messageTemplate, params object[] propertyValues)
Parameters
| Type | Name | Description |
|---|---|---|
| string | messageTemplate | The message template. |
| object[] | propertyValues | The property values to substitute into the template. |
LogInformation(string, params object[])
Logs an information message.
Declaration
public void LogInformation(string messageTemplate, params object[] propertyValues)
Parameters
| Type | Name | Description |
|---|---|---|
| string | messageTemplate | The message template. |
| object[] | propertyValues | The property values to substitute into the template. |
LogTrace(string, params object[])
Logs a trace message.
Declaration
public void LogTrace(string messageTemplate, params object[] propertyValues)
Parameters
| Type | Name | Description |
|---|---|---|
| string | messageTemplate | The message template. |
| object[] | propertyValues | The property values to substitute into the template. |
LogWarning(Exception, string, params object[])
Logs a warning message with an exception.
Declaration
public void LogWarning(Exception exception, string messageTemplate, params object[] propertyValues)
Parameters
| Type | Name | Description |
|---|---|---|
| Exception | exception | The exception to log. |
| string | messageTemplate | The message template. |
| object[] | propertyValues | The property values to substitute into the template. |
LogWarning(string, params object[])
Logs a warning message.
Declaration
public void LogWarning(string messageTemplate, params object[] propertyValues)
Parameters
| Type | Name | Description |
|---|---|---|
| string | messageTemplate | The message template. |
| object[] | propertyValues | The property values to substitute into the template. |
TraceDuration(Type, string, string, string?, object[]?, object[]?, object[]?)
Profiles an action and log as information messages.
Declaration
public DisposableTimer TraceDuration(Type loggerType, string startMessage, string completeMessage, string? failMessage = null, object[]? startMessageArgs = null, object[]? endMessageArgs = null, object[]? failMessageArgs = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | loggerType | The type to use as the logger category. |
| string | startMessage | The message to log when the timer starts. |
| string | completeMessage | The message to log when the timer ends successfully. |
| string | failMessage | The message to log if the operation fails. |
| object[] | startMessageArgs | Arguments for the start message template. |
| object[] | endMessageArgs | Arguments for the end message template. |
| object[] | failMessageArgs | Arguments for the fail message template. |
Returns
| Type | Description |
|---|---|
| DisposableTimer | A DisposableTimer that logs completion when disposed. |
TraceDuration<T>(string, object[]?)
Profiles an action and log as information messages.
Declaration
public DisposableTimer TraceDuration<T>(string startMessage, object[]? startMessageArgs = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | startMessage | The message to log when the timer starts. |
| object[] | startMessageArgs | Arguments for the start message template. |
Returns
| Type | Description |
|---|---|
| DisposableTimer | A DisposableTimer that logs completion when disposed. |
Type Parameters
| Name | Description |
|---|---|
| T | The type to use as the logger category. |
TraceDuration<T>(string, string, string?, object[]?, object[]?, object[]?)
Profiles an action and log as information messages.
Declaration
public DisposableTimer TraceDuration<T>(string startMessage, string completeMessage, string? failMessage = null, object[]? startMessageArgs = null, object[]? endMessageArgs = null, object[]? failMessageArgs = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | startMessage | The message to log when the timer starts. |
| string | completeMessage | The message to log when the timer ends successfully. |
| string | failMessage | The message to log if the operation fails. |
| object[] | startMessageArgs | Arguments for the start message template. |
| object[] | endMessageArgs | Arguments for the end message template. |
| object[] | failMessageArgs | Arguments for the fail message template. |
Returns
| Type | Description |
|---|---|
| DisposableTimer | A DisposableTimer that logs completion when disposed. |
Type Parameters
| Name | Description |
|---|---|
| T | The type to use as the logger category. |