Interface ILogService
Interface for a logging service with various logging capabilities and verbosity management.
Inherited Members
Namespace: Serenity.Logging.Application.Interfaces
Assembly: Serenity.Global.Application.dll
Syntax
public interface ILogService : IService, IFoundationSettings
Properties
Verbosity
Gets or sets the global verbosity level for the logging service.
Declaration
LogVerbosity Verbosity { get; set; }
Property Value
| Type | Description |
|---|---|
| LogVerbosity | The global verbosity level. |
Methods
ClearCategoryVerbosity(string)
Clears any specific verbosity setting for the given category, reverting to global verbosity.
Declaration
void ClearCategoryVerbosity(string category)
Parameters
| Type | Name | Description |
|---|---|---|
| string | category | The category to clear the verbosity for. |
For(string)
Gets a component-specific logger for the given category.
Declaration
ILoggerComponent For(string category)
Parameters
| Type | Name | Description |
|---|---|---|
| string | category | The category for the component logger. |
Returns
| Type | Description |
|---|---|
| ILoggerComponent | An IComponentLogger instance for the specified category. |
GetEffectiveVerbosity(string)
Gets the effective verbosity level for the specified category.
Declaration
LogVerbosity GetEffectiveVerbosity(string category)
Parameters
| Type | Name | Description |
|---|---|---|
| string | category | The category to check. |
Returns
| Type | Description |
|---|---|
| LogVerbosity | The effective verbosity level for the category. |
IsEnabledFor(string, LogSeverity)
Checks if logging is enabled for the specified category and severity level.
Declaration
bool IsEnabledFor(string category, LogSeverity severity)
Parameters
| Type | Name | Description |
|---|---|---|
| string | category | The category to check. |
| LogSeverity | severity | The severity level to check. |
Returns
| Type | Description |
|---|---|
| bool | True if logging is enabled for the category and severity; otherwise, false. |
SetCategoryVerbosity(string, LogVerbosity?)
Sets a specific verbosity level for the given category.
Declaration
void SetCategoryVerbosity(string category, LogVerbosity? verbosity)
Parameters
| Type | Name | Description |
|---|---|---|
| string | category | The category to set the verbosity for. |
| LogVerbosity? | verbosity | The verbosity level to set, or null to clear it. |
WriteErrorLog(string, string, params string[])
Writes an error log message.
Declaration
void WriteErrorLog(string message, string category = null, params string[] tags)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | The log message. |
| string | category | The category of the log message (optional). |
| string[] | tags | Additional tags for the log message (optional). |
WriteExceptionLog(Exception, string, string, params string[])
Writes an exception log entry with optional message and tags.
Declaration
void WriteExceptionLog(Exception exception, string message = null, string category = null, params string[] tags)
Parameters
| Type | Name | Description |
|---|---|---|
| Exception | exception | The exception to log. |
| string | message | An optional message providing context for the exception. |
| string | category | The category of the log message (optional). |
| string[] | tags | Additional tags for the log message (optional). |
WriteInformationLog(string, string, params string[])
Writes an information log message.
Declaration
void WriteInformationLog(string message, string category = null, params string[] tags)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | The log message. |
| string | category | The category of the log message (optional). |
| string[] | tags | Additional tags for the log message (optional). |
WriteLog(LogEntry)
Writes a log entry with the specified details.
Declaration
void WriteLog(LogEntry entry)
Parameters
| Type | Name | Description |
|---|---|---|
| LogEntry | entry | The log entry to write. |
WriteVerboseLog(string, string, params string[])
Writes a verbose log message.
Declaration
void WriteVerboseLog(string message, string category = null, params string[] tags)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | The log message. |
| string | category | The category of the log message (optional). |
| string[] | tags | Additional tags for the log message (optional). |
WriteWarningLog(string, string, params string[])
Writes a warning log message.
Declaration
void WriteWarningLog(string message, string category = null, params string[] tags)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | The log message. |
| string | category | The category of the log message (optional). |
| string[] | tags | Additional tags for the log message (optional). |