Class LogViewerServiceBase
Base class for log viewer services that provides common functionality for managing log entries and queries.
Inheritance
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public abstract class LogViewerServiceBase : ILogViewerService, IService
Constructors
View SourceLogViewerServiceBase(ILogViewerQueryRepository, ICoreScopeProvider, ILogViewerRepository)
Initializes a new instance of the LogViewerServiceBase class.
Declaration
protected LogViewerServiceBase(ILogViewerQueryRepository logViewerQueryRepository, ICoreScopeProvider provider, ILogViewerRepository logViewerRepository)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogViewerQueryRepository | logViewerQueryRepository | |
| ICoreScopeProvider | provider | |
| ILogViewerRepository | logViewerRepository |
Properties
View SourceLogViewerRepository
Gets the ILogViewerRepository.
Declaration
protected ILogViewerRepository LogViewerRepository { get; }
Property Value
| Type | Description |
|---|---|
| ILogViewerRepository |
LoggerName
Gets the name of the logger.
Declaration
protected abstract string LoggerName { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
View SourceAddSavedLogQueryAsync(string, string)
Adds a new saved log query to your chosen data source.
Declaration
public virtual Task<Attempt<ILogViewerQuery?, LogViewerOperationStatus>> AddSavedLogQueryAsync(string name, string query)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the new saved log query. |
| string | query | The query of the new saved log query. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<ILogViewerQuery, LogViewerOperationStatus>> |
CanViewLogsAsync(DateTimeOffset?, DateTimeOffset?)
Returns a value indicating whether the log files for the given time period are not too large to view (more than 1GB).
Declaration
public virtual Task<Attempt<bool, LogViewerOperationStatus>> CanViewLogsAsync(DateTimeOffset? startDate, DateTimeOffset? endDate)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTimeOffset? | startDate | The start date for the date range. |
| DateTimeOffset? | endDate | The end date for the date range. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<bool, LogViewerOperationStatus>> | The value whether or not you are able to view the logs. |
CanViewLogsAsync(LogTimePeriod)
Checks if the logs for the specified time period can be viewed.
Declaration
public abstract Task<Attempt<bool, LogViewerOperationStatus>> CanViewLogsAsync(LogTimePeriod logTimePeriod)
Parameters
| Type | Name | Description |
|---|---|---|
| LogTimePeriod | logTimePeriod |
Returns
| Type | Description |
|---|---|
| Task<Attempt<bool, LogViewerOperationStatus>> |
DeleteSavedLogQueryAsync(string)
Deletes a saved log query to your chosen data source.
Declaration
public virtual Task<Attempt<ILogViewerQuery?, LogViewerOperationStatus>> DeleteSavedLogQueryAsync(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the saved log search. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<ILogViewerQuery, LogViewerOperationStatus>> |
GetFilteredLogs(LogTimePeriod, string?, string[]?, Direction, int, int)
Gets a filtered page of logs from storage based on the provided parameters.
Declaration
protected PagedModel<ILogEntry> GetFilteredLogs(LogTimePeriod logTimePeriod, string? filterExpression, string[]? logLevels, Direction orderDirection, int skip, int take)
Parameters
| Type | Name | Description |
|---|---|---|
| LogTimePeriod | logTimePeriod | |
| string | filterExpression | |
| string[] | logLevels | |
| Direction | orderDirection | |
| int | skip | |
| int | take |
Returns
| Type | Description |
|---|---|
| PagedModel<ILogEntry> |
GetGlobalMinLogLevel()
Get the minimum log level value from the config file.
Declaration
public virtual LogLevel GetGlobalMinLogLevel()
Returns
| Type | Description |
|---|---|
| LogLevel |
GetLogLevelCountsAsync(DateTimeOffset?, DateTimeOffset?)
Returns a number of the different log level entries. The attempt will fail if the log files for the given time period are too large (more than 1GB).
Declaration
public virtual Task<Attempt<LogLevelCounts?, LogViewerOperationStatus>> GetLogLevelCountsAsync(DateTimeOffset? startDate, DateTimeOffset? endDate)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTimeOffset? | startDate | The start date for the date range. |
| DateTimeOffset? | endDate | The end date for the date range. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<LogLevelCounts, LogViewerOperationStatus>> |
GetLogLevelsFromSinks()
Get the log level values of the global minimum and the UmbracoFile one from the config file.
Declaration
public virtual ReadOnlyDictionary<string, LogLevel> GetLogLevelsFromSinks()
Returns
| Type | Description |
|---|---|
| ReadOnlyDictionary<string, LogLevel> |
GetMessageTemplatesAsync(DateTimeOffset?, DateTimeOffset?, int, int)
Returns a paged model of all unique message templates and their counts. The attempt will fail if the log files for the given time period are too large (more than 1GB).
Declaration
public virtual Task<Attempt<PagedModel<LogTemplate>, LogViewerOperationStatus>> GetMessageTemplatesAsync(DateTimeOffset? startDate, DateTimeOffset? endDate, int skip, int take)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTimeOffset? | startDate | The start date for the date range. |
| DateTimeOffset? | endDate | The end date for the date range. |
| int | skip | The amount of items to skip. |
| int | take | The amount of items to take. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<PagedModel<LogTemplate>, LogViewerOperationStatus>> |
GetPagedLogsAsync(DateTimeOffset?, DateTimeOffset?, int, int, Direction, string?, string[]?)
Gets all logs as a paged model. The attempt will fail if the log files for the given time period are too large (more than 1GB).
Declaration
public virtual Task<Attempt<PagedModel<ILogEntry>?, LogViewerOperationStatus>> GetPagedLogsAsync(DateTimeOffset? startDate, DateTimeOffset? endDate, int skip, int take, Direction orderDirection = Direction.Descending, string? filterExpression = null, string[]? logLevels = null)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTimeOffset? | startDate | The start date for the date range. |
| DateTimeOffset? | endDate | The end date for the date range. |
| int | skip | The amount of items to skip. |
| int | take | The amount of items to take. |
| Direction | orderDirection | The direction in which the log entries are to be ordered. |
| string | filterExpression | The query expression to filter on. |
| string[] | logLevels | The log levels for which to retrieve the log messages. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<PagedModel<ILogEntry>, LogViewerOperationStatus>> |
GetSavedLogQueriesAsync(int, int)
Get all saved log queries from your chosen data source as a paged model.
Declaration
public virtual Task<PagedModel<ILogViewerQuery>> GetSavedLogQueriesAsync(int skip, int take)
Parameters
| Type | Name | Description |
|---|---|---|
| int | skip | The amount of items to skip. |
| int | take | The amount of items to take. |
Returns
| Type | Description |
|---|---|
| Task<PagedModel<ILogViewerQuery>> |
GetSavedLogQueryByNameAsync(string)
Gets a saved log query by name from your chosen data source.
Declaration
public virtual Task<ILogViewerQuery?> GetSavedLogQueryByNameAsync(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The name of the saved log query. |
Returns
| Type | Description |
|---|---|
| Task<ILogViewerQuery> |
GetTimePeriod(DateTimeOffset?, DateTimeOffset?)
Returns a LogTimePeriod representation from a start and end date for filtering log files.
Declaration
protected virtual LogTimePeriod GetTimePeriod(DateTimeOffset? startDate, DateTimeOffset? endDate)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTimeOffset? | startDate | The start date for the date range (can be null). |
| DateTimeOffset? | endDate | The end date for the date range (can be null). |
Returns
| Type | Description |
|---|---|
| LogTimePeriod | The LogTimePeriod object used to filter logs. |