Skip to content

clsLogAudit

clsLogAudit is the static, opt-in audit-message logging entry point for hosting applications, dispatching business/application-event messages to either a local CSV file or the remote wsLogging SOAP web service.

Purpose

  • Provide AuditMessage/AuditCustomMessage entry points that record a business/application-event message, disabled by default (see BR-001).

Context

  • Namespace: SAIF.Framework.Logging
  • Assembly/package: SAIF.BOF.Framework.Logging (SAIF.Framework.Logging/SAIF.BOF.Framework.Logging.vbproj)
  • Class is Serializable with all Shared (static) members.

Public members

Member Signature Purpose
IsEnabled Shared Property IsEnabled As Boolean Gates whether audit logging performs any work; defaults False (see BR-001).
AuditMessage Shared Sub AuditMessage(inMsg As String) Records an audit message with no additional caller data.
AuditMessage Shared Sub AuditMessage(inMsg As String, ParamArray inData() As Object) Records an audit message along with caller-supplied data values.
AuditCustomMessage Shared Sub AuditCustomMessage(...) Records an audit message with fully custom context/data supplied by the caller.
ToFile Shared Sub ToFile() Redirects subsequent audit writes to a local CSV file (throws if IsWeb; see BR-003).
ToFile Shared Sub ToFile(fileName As String) Same as ToFile(), using a caller-supplied file name.

Behavioral notes

  • Every entry point first gathers ambient context (machine name, application name, page name, environment, current username) via a private GetBasicAuditInfo() method, which constructs a clsSecurityPrincipal (from SAIF.Framework.Security) purely to read the current user's identity*.
  • WriteMessage dispatches to a local file sink (if ToFile() was previously called) or, by default, to the wsLogging.clsWSLogging.WriteAudit SOAP operation.
  • All write paths are wrapped in Try...Catch with empty/'gobble gobble catch blocks, so a failure to log never propagates to the caller (see BR-005).

Constraints and usage notes

  • Callers must explicitly set IsEnabled = True for any audit call to produce output; by default all audit calls are no-ops.
  • ToFile()/ToFile(fileName) must not be called from a web application; doing so throws ApplicationException("Logging to files not valid for web applications.").

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • SAIF.Framework.Logging/clsLogAudit.vb
  • SAIF.Framework.Logging/AuditInfoStruct.vb