Skip to content

Revist user Logging configuration for connections and clients

Nathan Harris requested to merge custom-logging into master

NOTE: This description no longer accurately reflects the changes made after discussions during the review process. See the final changes with commit https://gitlab.com/Mordil/swift-redi-stack/commit/209ba87bf53445ab92c0c1dc6ab5c4a7845a3b86

Motivation:

Logging is more dynamic in real world usage than the current static heavy API allows.

Users generally want to be capable of updating connection logger metadata to attach dynamic properties such as an HTTP request ID for log tracing.

Modifications:

  • Add logger: Logging.Logger requirement to RedisClient
  • Add new RedisLoggingPreference enum to let users specify how to handle logging
  • Add logging(to:) and setLogging(to:) methods to RedisClient
  • Move all log statements to RedisConnection
  • Rename logger: parameter arguments(s) to loggingPreference:
  • Change when RedisConnection.init logging and metric calls are made

Result:

Users should have infinitely more flexibility in how RedisConnection, and RedisClient implementations in general, behave in regards to logging.

Edited by Nathan Harris

Merge request reports