Class ComponentLogger
Logger implementation for a specific application component, delegating to a root log service.
Inherited Members
Namespace: Serenity.Logging.Application.Services
Assembly: Serenity.Global.Application.dll
Syntax
public class ComponentLogger : ILoggerComponent, IComponent, IFoundationSettings
Constructors
ComponentLogger(ILogService, string)
Initializes a new instance of the ComponentLogger class.
Declaration
public ComponentLogger(ILogService root, string category)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogService | root | The root log service to delegate logging operations to. |
| string | category | The category associated with this logger instance. |
Fields
_guid
Declaration
protected string _guid
Field Value
| Type | Description |
|---|---|
| string |
_id
Declaration
protected string _id
Field Value
| Type | Description |
|---|---|
| string |
Properties
Category
Gets the category of the logger.
Declaration
public string Category { get; }
Property Value
| Type | Description |
|---|---|
| string | The category as a string. |
EffectiveVerbosity
Gets the effective verbosity level for the logger.
Declaration
public LogVerbosity EffectiveVerbosity { get; }
Property Value
| Type | Description |
|---|---|
| LogVerbosity | The effective verbosity level. |
Guid
Declaration
public string Guid { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Id
Declaration
public string Id { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
IsEnabledFor(LogSeverity)
Checks if logging is enabled for the specified severity level.
Declaration
public bool IsEnabledFor(LogSeverity severity)
Parameters
| Type | Name | Description |
|---|---|---|
| LogSeverity | severity | The severity level to check. |
Returns
| Type | Description |
|---|---|
| bool | True if logging is enabled for the specified severity; otherwise, false. |
WriteErrorLog(string, params string[])
Writes an error log message.
Declaration
public void WriteErrorLog(string message, params string[] tags)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | The log message. |
| string[] | tags | Optional tags for the log message. |
WriteExceptionLog(Exception, string, params string[])
Writes an exception log message with optional context.
Declaration
public void WriteExceptionLog(Exception ex, string message = null, params string[] tags)
Parameters
| Type | Name | Description |
|---|---|---|
| Exception | ex | The exception to log. |
| string | message | Optional additional message providing context. |
| string[] | tags | Optional tags for the log message. |
WriteInfoLog(string, params string[])
Writes an informational log message.
Declaration
public void WriteInfoLog(string message, params string[] tags)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | The log message. |
| string[] | tags | Optional tags for the log message. |
WriteVerboseLog(string, params string[])
Writes a verbose log message.
Declaration
public void WriteVerboseLog(string message, params string[] tags)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | The log message. |
| string[] | tags | Optional tags for the log message. |
WriteWarningLog(string, params string[])
Writes a warning log message.
Declaration
public void WriteWarningLog(string message, params string[] tags)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | The log message. |
| string[] | tags | Optional tags for the log message. |