Write to the console/application log (contract only)¶
Define (without implementing) a console/file logging contract, triggered when a consuming console/batch application writes progress, errors, or exception detail to one or more log files*.
| Field | Value |
|---|---|
| Operation ID | OP-038 |
| Trigger | A consuming console/batch application writes progress, errors, or exception detail to one or more log files* |
| Inputs | message, logId or LogType, filePath, Exception |
| Outputs | Log output (implementation-defined) |
| Primary components | SAIF.Common.Interfaces.IConsoleLogService` and `SAIF.Common.Interfaces.ILogWriter |
| Entry point | Common/SAIF.Common/Interfaces/IConsoleLogService.cs |
Steps¶
- The application registers a log file against a string
logIdusingRegisterLogFile(logId, filePath). (BR-091) - It retrieves an
ILogWriterby string id (GetLog(string)) or by theLogTypeenum (GetLog(LogType)—File0-File4orCustom), or enumerates them all viaLogs. (BR-091, BR-092) - It writes through
Write/WriteError(service level) orWrite/WriteLine/WriteTimedLine(writer level).WriteToAppLog(message, logId, bool line = true)defaults to appending a line break, whileWriteToAppLog(message, LogType, bool line = false)defaults to not appending one. (BR-093) - Timestamp rendering on
WriteTimedLineis configured per writer throughSetTimeFormat,SetTimeDelimiter, andSetWriteLinePrefix. (BR-091) LogException(Exception)records an exception; buffered output is pushed withFlush(),Flush(logId), orFlush(LogType). (BR-091)- Both interfaces extend
IDisposable, so the application is expected to dispose the service (and thereby its writers) at shutdown. (BR-094)
Process flow¶
The following diagram visualizes this operation's control flow.
flowchart TD
Start(["Consuming app writes progress,<br>errors, or exception detail"]) --> S1["Register a log file against<br>logId via RegisterLogFile"]
S1 --> S2["Retrieve an ILogWriter by string id,<br>by the LogType enum, or<br>enumerate all via Logs"]
S2 --> S3["Write via Write/WriteError,<br>or WriteToAppLog (line-break<br>default varies by overload)"]
S3 --> S4["Configure timestamp rendering per<br>writer via SetTimeFormat,<br>SetTimeDelimiter, SetWriteLinePrefix"]
S4 --> S5["LogException records an exception;<br>Flush pushes buffered output"]
S5 --> S6["Application disposes the service<br>and its writers at shutdown"]
S6 --> End(["Log output written and<br>resources released"])
Failure and edge-case behavior¶
- These are contracts only — this library provides no implementation of
IConsoleLogServiceorILogWriter. The step sequence above describes the contract's intended usage, inferred from the member signatures; the actual behavior is defined by whichever consuming assembly implements them.*
Related documentation¶
Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.
Sources¶
Common/SAIF.Common/Interfaces/IConsoleLogService.csCommon/SAIF.Common/Interfaces/ILogWriter.csCommon/SAIF.Common/Enums/LogType.cs