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
IsErrorEnabled
True if error-level logging is enabled. Use to guard expensive message construction.
public virtual bool IsErrorEnabled { get; }
Property Value
IsFatalEnabled
True if fatal-level logging is enabled. Use to guard expensive message construction.
public virtual bool IsFatalEnabled { get; }
Property Value
IsInfoEnabled
True if info-level logging is enabled. Use to guard expensive message construction.
public virtual bool IsInfoEnabled { get; }
Property Value
IsTraceEnabled
True if trace-level logging is enabled. Use to guard expensive message construction.
public virtual bool IsTraceEnabled { get; }
Property Value
IsWarnEnabled
True if warn-level logging is enabled. Use to guard expensive message construction.
public virtual bool IsWarnEnabled { get; }
Property Value
Methods
Add(LogLevel, string)
Log a message at the info level.
public abstract void Add(CPLogBaseClass.LogLevel level, string logMessage)
Parameters
levelCPLogBaseClass.LogLevellogMessagestring
Add(string)
Log a message at the info level. (same a Info(logMessage))
public abstract void Add(string logMessage)
Parameters
logMessagestring
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
logMessagestring
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
exException
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
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
logMessagestring
Fatal(Exception)
Log a fatal-level exception. Use for critical failures that prevent the application from continuing.
public abstract void Fatal(Exception ex)
Parameters
exException
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
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
logMessagestring
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
logMessagestring
Trace(string)
Log a trace-level message. Use for fine-grained diagnostics like method entry/exit.
public abstract void Trace(string logMessage)
Parameters
logMessagestring
Warn(Exception)
Log a warn-level exception. Use for incorrect behavior the application can recover from.
public abstract void Warn(Exception ex)
Parameters
exException
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
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
logMessagestring