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/AuditCustomMessageentry 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
Serializablewith 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 aclsSecurityPrincipal(fromSAIF.Framework.Security) purely to read the current user's identity*. WriteMessagedispatches to a local file sink (ifToFile()was previously called) or, by default, to thewsLogging.clsWSLogging.WriteAuditSOAP operation.- All write paths are wrapped in
Try...Catchwith empty/'gobble gobblecatch blocks, so a failure to log never propagates to the caller (see BR-005).
Constraints and usage notes¶
- Callers must explicitly set
IsEnabled = Truefor 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 throwsApplicationException("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.
Related documentation¶
Sources¶
SAIF.Framework.Logging/clsLogAudit.vbSAIF.Framework.Logging/AuditInfoStruct.vb