Table of Contents

Class LoggingPolicy

Namespace
CMS.Core
Assembly
CMS.Core.dll

Logging policy allows to limit the number of logged events.

public class LoggingPolicy
Inheritance
object
LoggingPolicy
Extension Methods

Constructors

LoggingPolicy(TimeSpan)

Creates new logging policy of type OncePerPeriod.

public LoggingPolicy(TimeSpan period)

Parameters

period TimeSpan

Period value.

Examples

var policy = new LoggingPolicy(TimeSpan.FromMinutes(15));
Service.Resolve<IEventLogService>().LogException("Data", "UPDATE", ex, policy);

Remarks

You can use ONLY_ONCE constant instead of System.TimeSpan.Zero for events that should be logged only once without period limit.

Fields

DEFAULT

Default logging policy ensures that events are always logged.

public static readonly LoggingPolicy DEFAULT

Field Value

LoggingPolicy

ONLY_ONCE

Policy ensures that events are logged only once per application lifetime.

public static readonly LoggingPolicy ONLY_ONCE

Field Value

LoggingPolicy

Properties

Period

Logging period.

public TimeSpan Period { get; }

Property Value

TimeSpan

Remarks

Applicable when policy type is OncePerPeriod.

Type

Logging policy type.

public LoggingPolicyEnum Type { get; }

Property Value

LoggingPolicyEnum