Operations and processes¶
This library performs 12 distinct operations across its three host-style loggers (web, Windows Service, console), spanning configuration/bootstrap, log-entry emission, exception formatting, outbound delivery to the SAIF Logging API, and disposal.
Operation catalog¶
Process flow diagram¶
The following diagram visualizes the primary operational flow across these twelve operations, from configuration through log emission to disposal.
flowchart TD
A[Host calls Configure] --> B{Read Environment API threshold}
B -->|present or resolved| C[Apply appsettings.json overrides - OP-04]
B -->|missing / invalid| B1["ArgumentException - Configure fails;<br>IsConfigured stays false on first attempt,<br>or keeps its prior value on a later failed attempt"]
C --> D["Build Serilog pipeline + sinks"]
D --> E["IsConfigured = true"]
E --> F[Caller invokes a log method]
F --> G{Entry type}
G -->|info / warning| H[Emit information log entry - OP-05]
G -->|exception| I[Format exception - OP-06 / OP-07]
H --> J[Correlate with Activity - OP-10]
I --> J
J --> K{IsConfigured?}
K -->|No| K1["Debug.Write diagnostic only; log ID still returned"]
K -->|Yes| L["Write to ILogger, Serilog sinks"]
L --> M{Sink}
M -->|Logging API sink| N["IsException? - route to Send or SendException - OP-08"]
M -->|Console / Event Log| O[Automatic sink write]
F2["Host explicitly calls<br>WriteToAppLog / GetLog.Write*"] --> O2["Write console log file entry - OP-09<br>(separate explicit path, not a Serilog sink)"]
N -->|unsuccessful RequestResult| P[Report to Console/Debug only]
Q[Host disposes the logger] --> R[Dispose and flush - OP-12]
Failure and edge-case behavior¶
- If neither the application-named nor the
tracingdefaultsbase-threshold key resolves to a valid level,ConfigurethrowsArgumentExceptionand the logger does not become configured by this call —IsConfiguredstaysfalseif this is the firstConfigureattempt, or keeps its priortruevalue if a previously-successfulConfigureis being retried (BR-LOG-08); every subsequent log call still returns a generated correlation ID (for exception-bearing calls, only once the pre-ID exception-formatting steps succeed) but writes only a Debug-level diagnostic trace instead of reachingILogger/Serilog whenIsConfiguredisfalse. - An invalid
SaifLogging:BaseLevelvalue failsConsoleLogService's constructor, which fails DI resolution ofIConsoleLogServicefor the whole host. - A
SaifLogging:Loggersoverride entry with an invalid or missingTypethrowsSaifLogConfigurationException; one with a missingLevelthrowsArgumentException(see BR-LOG-04). SaifWindowsServiceLognever readslogerrorroute, so error entries from that host are posted with anullroute.LoggingApiSink.Emitisasync voidwith no try/catch anywhere in the class; an unsuccessful HTTP result is reported only to Console/Debug, but a thrown exception from the POST call itself is not caught anywhere in this sink — there is no universal failure-containment guarantee (BR-LOG-15).- The console host's auxiliary file channels (
file0–file4) are not automatic Serilog sinks fanned out from the main pipeline; they are only reached when the host explicitly callsWriteToAppLog/GetLog(logType).Write*(OP-09).
Related documentation¶
- Index
- Overview
- Architecture
- Dependencies
- Configuration
- Service registration
- Business rules
- API reference
Sources¶
src/SAIF.NetCore.Logging/SAIF.NetCore.Logging/SAIF.NetCore.Logging/SaifLogBase.cssrc/SAIF.NetCore.Logging/SAIF.NetCore.Logging/SAIF.NetCore.Logging/SaifLog.cssrc/SAIF.NetCore.Logging/SAIF.NetCore.Logging/SAIF.NetCore.Logging/SaifWindowsServiceLog.cssrc/SAIF.NetCore.Logging/SAIF.NetCore.Logging/SAIF.NetCore.Logging/ConsoleLogService.cssrc/SAIF.NetCore.Logging/SAIF.NetCore.Logging/SAIF.NetCore.Logging/Loggers/LoggingApiSink.cssrc/SAIF.NetCore.Logging/SAIF.NetCore.Logging/SAIF.NetCore.Logging/ExceptionFormatter/ExceptionFormatService.cssrc/SAIF.NetCore.Logging/SAIF.NetCore.Logging/SAIF.NetCore.Logging/Web/WebHostBuilderExtensions.cs