Class SerilogLogViewerSourceBase
Serves as the base class for log viewer sources that utilize Serilog, providing shared functionality for derived log viewer implementations.
Inheritance
Namespace: Umbraco.Cms.Core.Logging.Viewer
Assembly: Umbraco.Infrastructure.dll
Syntax
[Obsolete("Use ILogViewerService instead. Scheduled for removal in Umbraco 18.")]
public abstract class SerilogLogViewerSourceBase : ILogViewer
Constructors
View SourceSerilogLogViewerSourceBase(ILogViewerConfig, ILogLevelLoader, ILogger)
Declaration
protected SerilogLogViewerSourceBase(ILogViewerConfig logViewerConfig, ILogLevelLoader logLevelLoader, ILogger serilogLog)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogViewerConfig | logViewerConfig | |
| ILogLevelLoader | logLevelLoader | |
| ILogger | serilogLog |
Properties
View SourceCanHandleLargeLogs
Gets a value indicating whether this log viewer source is capable of efficiently handling large log files.
Declaration
public abstract bool CanHandleLargeLogs { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
View SourceAddSavedSearch(string, string)
Adds a saved log search with the specified name and query.
Declaration
[Obsolete("Use ILogViewerService.AddSavedLogQueryAsync instead. Scheduled for removal in Umbraco 15.")]
public virtual IReadOnlyList<SavedLogSearch> AddSavedSearch(string name, string query)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the saved search. |
| string | query | The query string for the saved search. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<SavedLogSearch> | A read-only list of saved log searches including the newly added one. |
Remarks
This method is obsolete. Use ILogViewerService.AddSavedLogQueryAsync instead.
CheckCanOpenLogs(LogTimePeriod)
Determines whether logs can be opened for the specified time period.
Declaration
[Obsolete("Use ILogViewerService.CanViewLogsAsync instead. Scheduled for removal in Umbraco 15.")]
public abstract bool CheckCanOpenLogs(LogTimePeriod logTimePeriod)
Parameters
| Type | Name | Description |
|---|---|---|
| LogTimePeriod | logTimePeriod | The time period for which to check log availability. |
Returns
| Type | Description |
|---|---|
| bool | True if logs can be opened for the specified time period; otherwise, false. |
DeleteSavedSearch(string)
Deletes a saved log search by name and returns the updated list of saved log searches.
Declaration
[Obsolete("Use ILogViewerService.DeleteSavedLogQueryAsync instead. Scheduled for removal in Umbraco 15.")]
public virtual IReadOnlyList<SavedLogSearch> DeleteSavedSearch(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the saved log search to delete. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<SavedLogSearch> | The updated list of saved log searches after deletion. |
GetLogLevelCounts(LogTimePeriod)
Returns the number of log entries for each log level within the specified time period.
Declaration
[Obsolete("Use ILogViewerService.GetLogLevelCounts instead. Scheduled for removal in Umbraco 15.")]
public LogLevelCounts GetLogLevelCounts(LogTimePeriod logTimePeriod)
Parameters
| Type | Name | Description |
|---|---|---|
| LogTimePeriod | logTimePeriod | The time period to analyze for log level counts. |
Returns
| Type | Description |
|---|---|
| LogLevelCounts | A LogLevelCounts object containing the count of log entries per log level. |
GetLogLevels()
Retrieves the Serilog minimum-level and UmbracoFile-level values from the configuration file.
Declaration
[Obsolete("Use ILogViewerService.GetLogLevelsFromSinks instead. Scheduled for removal in Umbraco 15.")]
public ReadOnlyDictionary<string, LogEventLevel?> GetLogLevels()
Returns
| Type | Description |
|---|---|
| ReadOnlyDictionary<string, LogEventLevel?> | A read-only dictionary that maps sink names to their corresponding Serilog.Events.LogEventLevel values, or |
GetLogs(LogTimePeriod, int, int, Direction, string?, string[]?)
Retrieves a paged list of log messages filtered by the specified time period, filter expression, and log levels.
Declaration
[Obsolete("Use ILogViewerService.GetPagedLogs instead. Scheduled for removal in Umbraco 15.")]
public PagedResult<LogMessage> GetLogs(LogTimePeriod logTimePeriod, int pageNumber = 1, int pageSize = 100, Direction orderDirection = Direction.Descending, string? filterExpression = null, string[]? logLevels = null)
Parameters
| Type | Name | Description |
|---|---|---|
| LogTimePeriod | logTimePeriod | The time period to filter logs. |
| int | pageNumber | The page number to retrieve. The default is 1. |
| int | pageSize | The number of log messages per page. The default is 100. |
| Direction | orderDirection | The direction in which to order the logs by timestamp. The default is Descending. |
| string | filterExpression | An optional filter expression to filter log messages. |
| string[] | logLevels | An optional array of log levels to include. |
Returns
| Type | Description |
|---|---|
| PagedResult<LogMessage> | A PagedResult<T> containing the filtered log messages. |
Remarks
This method is obsolete. Use ILogViewerService.GetPagedLogs instead. Scheduled for removal in Umbraco 15.
GetLogs(LogTimePeriod, ILogFilter, int, int)
Get all logs from your chosen data source back as Serilog LogEvents
Declaration
protected abstract IReadOnlyList<LogEvent> GetLogs(LogTimePeriod logTimePeriod, ILogFilter filter, int skip, int take)
Parameters
| Type | Name | Description |
|---|---|---|
| LogTimePeriod | logTimePeriod | |
| ILogFilter | filter | |
| int | skip | |
| int | take |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<LogEvent> |
GetLogsAsPagedModel(LogTimePeriod, int, int, Direction, string?, string[]?)
Retrieves log messages as a paged model, filtered and ordered according to the specified parameters.
Declaration
[Obsolete("Use ILogViewerService.GetPagedLogs instead. Scheduled for removal in Umbraco 15.")]
public PagedModel<LogMessage> GetLogsAsPagedModel(LogTimePeriod logTimePeriod, int skip, int take, Direction orderDirection = Direction.Descending, string? filterExpression = null, string[]? logLevels = null)
Parameters
| Type | Name | Description |
|---|---|---|
| LogTimePeriod | logTimePeriod | The time period to filter logs by. |
| int | skip | The number of log entries to skip (for pagination). |
| int | take | The number of log entries to return (for pagination). |
| Direction | orderDirection | The direction to order the logs by timestamp (ascending or descending). Defaults to Descending. |
| string | filterExpression | An optional filter expression to further filter logs. |
| string[] | logLevels | An optional array of log levels to filter logs. |
Returns
| Type | Description |
|---|---|
| PagedModel<LogMessage> | A PagedModel<T> containing the filtered and paged log messages. |
Remarks
This method is obsolete. Use ILogViewerService.GetPagedLogs instead. Scheduled for removal in Umbraco 15.
GetMessageTemplates(LogTimePeriod)
Retrieves a collection of log message templates and their occurrence counts within the specified time period.
Declaration
[Obsolete("Use ILogViewerService.GetMessageTemplates instead. Scheduled for removal in Umbraco 15.")]
public IEnumerable<LogTemplate> GetMessageTemplates(LogTimePeriod logTimePeriod)
Parameters
| Type | Name | Description |
|---|---|---|
| LogTimePeriod | logTimePeriod | The time period used to filter log entries. |
Returns
| Type | Description |
|---|---|
| IEnumerable<LogTemplate> | An ordered enumerable of LogTemplate objects, each representing a unique message template and its count. |
GetNumberOfErrors(LogTimePeriod)
Gets the number of errors within the specified log time period.
Declaration
public int GetNumberOfErrors(LogTimePeriod logTimePeriod)
Parameters
| Type | Name | Description |
|---|---|---|
| LogTimePeriod | logTimePeriod | The time period for which to count errors. |
Returns
| Type | Description |
|---|---|
| int | The count of errors in the specified time period. |
GetSavedSearches()
Gets the saved log searches.
Declaration
[Obsolete("Use ILogViewerService.GetSavedLogQueriesAsync instead. Scheduled for removal in Umbraco 15.")]
public virtual IReadOnlyList<SavedLogSearch> GetSavedSearches()
Returns
| Type | Description |
|---|---|
| IReadOnlyList<SavedLogSearch> | A read-only list of saved log searches. |
Remarks
This method is obsolete. Use ILogViewerService.GetSavedLogQueriesAsync instead.