Table of Contents

Class CPLogBaseClass

Namespace
Contensive.BaseClasses
Assembly
CPBase.dll

CP.Log — the primary logging interface for application code. Use cp.Log methods (Trace, Debug, Info, Warn, Error, Fatal) for all application-level logging. These write to the application log file at the specified NLog severity level.

For operational alerts that require admin attention, see also:

  • cp.Site.ErrorReport() — logs at ERROR level and sends error notifications. Use for unexpected exceptions.
  • cp.Site.LogAlarm() — writes to the server Alarms folder and triggers the server alarm monitor. Use only for fatal/critical issues requiring immediate admin intervention.
  • cp.Site.SetSiteWarning() — displays a warning indicator in the admin UI. Use for content or configuration issues an admin can fix.
public abstract class CPLogBaseClass : IDisposable
Inheritance
CPLogBaseClass
Implements
Inherited Members

Properties

IsDebugEnabled

True if debug-level logging is enabled. Use to guard expensive message construction.

public virtual bool IsDebugEnabled { get; }

Property Value

bool

IsErrorEnabled

True if error-level logging is enabled. Use to guard expensive message construction.

public virtual bool IsErrorEnabled { get; }

Property Value

bool

IsFatalEnabled

True if fatal-level logging is enabled. Use to guard expensive message construction.

public virtual bool IsFatalEnabled { get; }

Property Value

bool

IsInfoEnabled

True if info-level logging is enabled. Use to guard expensive message construction.

public virtual bool IsInfoEnabled { get; }

Property Value

bool

IsTraceEnabled

True if trace-level logging is enabled. Use to guard expensive message construction.

public virtual bool IsTraceEnabled { get; }

Property Value

bool

IsWarnEnabled

True if warn-level logging is enabled. Use to guard expensive message construction.

public virtual bool IsWarnEnabled { get; }

Property Value

bool

Methods

Add(LogLevel, string)

Log a message at the info level.

public abstract void Add(CPLogBaseClass.LogLevel level, string logMessage)

Parameters

level CPLogBaseClass.LogLevel
logMessage string

Add(string)

Log a message at the info level. (same a Info(logMessage))

public abstract void Add(string logMessage)

Parameters

logMessage string

Debug(string)

Log a debug-level message. Use for diagnostic details like executed queries, authentication events, or session state.

public abstract void Debug(string logMessage)

Parameters

logMessage string

Dispose()

Support disposable for non-default datasources

public abstract void Dispose()

Error(Exception)

Log an error-level exception. Use for application errors and exceptions that indicate a bug or unexpected failure.

public abstract void Error(Exception ex)

Parameters

ex Exception

Error(Exception, string)

Log an error-level message with an exception. Use for application errors and exceptions that indicate a bug or unexpected failure.

public abstract void Error(Exception ex, string logMessage)

Parameters

ex Exception
logMessage string

Error(string)

Log an error-level message. Use for application errors and exceptions that indicate a bug or unexpected failure. For errors that also need admin notification, consider cp.Site.ErrorReport() instead.

public abstract void Error(string logMessage)

Parameters

logMessage string

Fatal(Exception)

Log a fatal-level exception. Use for critical failures that prevent the application from continuing.

public abstract void Fatal(Exception ex)

Parameters

ex Exception

Fatal(Exception, string)

Log a fatal-level message with an exception. Use for critical failures that prevent the application from continuing.

public abstract void Fatal(Exception ex, string logMessage)

Parameters

ex Exception
logMessage string

Fatal(string)

Log a fatal-level message. Use for critical failures that prevent the application from continuing. To also trigger the server alarm monitor, use cp.Site.LogAlarm() instead.

public abstract void Fatal(string logMessage)

Parameters

logMessage string

Info(string)

Log an info-level message. Use for normal operational events like mail sent, profile updated, or process completed.

public abstract void Info(string logMessage)

Parameters

logMessage string

Trace(string)

Log a trace-level message. Use for fine-grained diagnostics like method entry/exit.

public abstract void Trace(string logMessage)

Parameters

logMessage string

Warn(Exception)

Log a warn-level exception. Use for incorrect behavior the application can recover from.

public abstract void Warn(Exception ex)

Parameters

ex Exception

Warn(Exception, string)

Log a warn-level message with an exception. Use for incorrect behavior the application can recover from.

public abstract void Warn(Exception ex, string logMessage)

Parameters

ex Exception
logMessage string

Warn(string)

Log a warn-level message. Use for incorrect behavior the application can recover from, such as rate limits, missing optional data, or retryable failures.

public abstract void Warn(string logMessage)

Parameters

logMessage string