Skip to content
  • Nathan Harris's avatar
    Refactor Logging implementation · 90244e32
    Nathan Harris authored
    Motivation:
    
    The original implementation of Logging was done in more haste than should have been, without proper attention given to the semantic requirements.
    
    As the Swift ecosystem has matured a bit, lessons have been learned on handling metadata and passing of external context into internal subcomponents.
    
    A mixture of the "protocol-based context passing" and "explicit context passing" patterns have been adopted.
    
    Both patterns are more fully described in the Swift forum discussion: https://forums.swift.org/t/the-context-passing-problem/39162
    
    Modifications:
    
    - Add: `RedisLogging` namespace with references to static keys and labels that are used for Logging throughout the library
    - Add: `Logger` static computed properties to access the Logger prototypes used in connection and connection pools
    - Add: `RedisClientWithUserContext` protocol and `UserContextRedisClient` types to assist with wrapping client types for custom logger contexts
    - Remove: `logger` property from `RedisClient` requirements
    - Change: Many log statements to have higher or lower log levels for their appropriate context
    - Change: `RedisConnection` and `RedisConnectionPool` to conform to `RedisClientWithUserContext`
    - Change: `logging(to:)` protocol requirement to return a `RedisClient` existential
    - Change: ConnectionPool to explicitly pass a logger instance around for pooling methods
    
    Result:
    
    Logging in RediStack will now have a stronger contract of where and how logs will be generated and which context will be used.
    
    Fixes #79 and #74
    90244e32
After you've reviewed these contribution guidelines, you'll be all set to contribute to this project.