NexusConfig.LoggerFactory to any Microsoft.Extensions.Logging.ILoggerFactory.
AddWestyxNexus() picks up the application’s ILoggerFactory automatically, so there is nothing to configure:
LoggerFactory null discards all SDK output (NullLoggerFactory). builder.AddWestyxNexus(config) creates its client before the application’s ILoggerFactory exists, so on that path set NexusConfig.LoggerFactory to route SDK diagnostics.
The SDK writes nothing on its own: a library logs through the factory the application gives it and falls back to null logging without one, which is Microsoft’s guidance for library authors. Where and how loudly to log stays the application’s decision.
Seeing what the client loaded
At startup the client logs twoInformation records under Westyx.Nexus.NexusClient: the client-ready line, and a summary naming the configs, secrets and flags the first sync delivered - names only, never a value; more than 50 of one kind end in a count.
With no
LoggerFactory, set WESTYX_NEXUS_LOG_STARTUP=1 (NexusConfig.LogStartupEnvironmentVariable) - for example in a pod manifest - and the summary is written to standard error as one line, with no code change:
LoggerFactory the variable adds nothing; the summary goes through the factory.
A quick console logger for the configuration-source path:
Categories
The SDK takes anILoggerFactory rather than an ILogger<NexusClient> specifically so it can log under separate categories. That lets you turn one subsystem up without drowning in the others.
Structured messages
Log statements go through theLoggerMessage source generator, so parameters arrive as structured fields rather than being baked into the message text:
EventId, so you can alert on one specific occurrence without matching on text.
Secrets never appear in logs
No SDK log message contains a secret value, an API key or a session JWT - not even truncated. Key names do appear (the startup summary, an omitted resource); a name is not a value. File-type secrets are identified by a path, never by content. This is enforced, not merely intended: a test in the suite drives a client through initial sync, a secret read, a file-secret materialisation and a WIF exchange against a capturing logger, and fails the build if any seeded sensitive value appears in the rendered message, the structured state or an exception.Logging a NexusConfig
NexusConfig.ApiKey and NexusOptions.ApiKey carry [JsonIgnore] and [IgnoreDataMember], so a configuration serialized through System.Text.Json or Newtonsoft.Json contains the base URL and not the key.
Serilog’s destructuring operator honours neither. {@Config} walks public properties directly, so log a config as {Config}:
record prints its properties from the compiler-generated ToString(), so a secret bound into one reaches any log that prints it. Use a class for a type that holds a secret.
Related
- Dependency injection
- Stream observer - structured SSE lifecycle callbacks, complementary to logging
- Error handling
- Design decisions
