C# Class CK.Core.SystemActivityMonitor

This ActivityMonitor logs errors in a directory (if the static RootLogPath property is not null) and raises OnError events. Its main goal is to be internally used by the Monitor framework but can be used as a "normal" monitor (if you believe it is a good idea). The easiest way to configure it is to set an application settings with the key "CK.Core.SystemActivityMonitor.RootLogPath" and the root path for logs as the value.
The RootLogPath uses the Application configuration (if it exists): <appSettings> <add key="CK.Core.SystemActivityMonitor.RootLogPath" value="..." /> </appSettings> If the setting is not there, the Critical errors will NOT be logged except if it is explicitly set: SystemActivityMonitor.RootLogPath = "...";
Inheritance: ActivityMonitor
Mostra file Open project: Invenietis/ck-core Class Usage Examples

Public Properties

Property Type Description
AppSettingsKey string
SubDirectoryName string

Public Methods

Method Description
AssertRootLogPathIsSet ( ) : void

Checks that RootLogPath is correctly configured by throwing a detailed exception if not.

EnsureStaticInitialization ( ) : bool

Touches this type to ensure that its static information is initialized. This does nothing except that, since the Type is solicited, the type constructor is called if needed.

EnsureSystemClient ( IActivityMonitor monitor ) : IDisposable

Registers the internal system client that routes errors and fatals as ActivityMonitor errors.

SystemActivityMonitor ( bool applyAutoConfigurations, string topic ) : System

Initializes a new SystemActivityMonitor that can behave as a standard monitor (when automatic configurations applies).

Private Methods

Method Description
CreateHeader ( DateTimeStamp logTime, string text, LogLevel level, CKTrait tags ) : StringBuilder
DumpErrorText ( DateTimeStamp logTime, string text, LogLevel level, CKTrait tags, CKExceptionData exData ) : string
DumpErrorText ( DateTimeStamp logTime, string text, LogLevel level, Exception ex, CKTrait tags ) : string
HandleError ( string s ) : void
NormalizeRootLogPath ( string value ) : string
OnTrackActivityMonitorLoggingError ( object sender, CriticalErrorCollector e ) : void
SystemActivityMonitor ( ) : System
WriteFooter ( LogLevel level, StringBuilder buffer ) : void

Method Details

AssertRootLogPathIsSet() public static method

Checks that RootLogPath is correctly configured by throwing a detailed exception if not.
public static AssertRootLogPathIsSet ( ) : void
return void

EnsureStaticInitialization() static public method

Touches this type to ensure that its static information is initialized. This does nothing except that, since the Type is solicited, the type constructor is called if needed.
static public EnsureStaticInitialization ( ) : bool
return bool

EnsureSystemClient() public static method

Registers the internal system client that routes errors and fatals as ActivityMonitor errors.
public static EnsureSystemClient ( IActivityMonitor monitor ) : IDisposable
monitor IActivityMonitor The monitor that can be temporary works as a .
return IDisposable

SystemActivityMonitor() public method

Initializes a new SystemActivityMonitor that can behave as a standard monitor (when automatic configurations applies).
public SystemActivityMonitor ( bool applyAutoConfigurations, string topic ) : System
applyAutoConfigurations bool True to apply automatic configurations and, hence, behave like any other .
topic string Optional initial topic (can be null).
return System

Property Details

AppSettingsKey static_oe public_oe property

The key in the application settings used to initialize the RootLogPath if it exists in AppSettings.Default.
static public string AppSettingsKey
return string

SubDirectoryName static_oe public_oe property

The directory in RootLogPath into which errors file will be created is "CriticalErrors/".
static public string SubDirectoryName
return string