mirror of
https://github.com/swift-server/RediStack.git
synced 2026-06-02 07:37:33 +00:00
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
64 lines
2.2 KiB
Markdown
64 lines
2.2 KiB
Markdown
## Legal
|
|
|
|
By submitting a pull request, you represent that you have the right to license your contribution to the community, and agree by submitting the patch
|
|
that your contributions are licensed under the [Apache 2.0 license](https://www.apache.org/licenses/LICENSE-2.0.html) (see [`LICENSE`](../LICENSE)).
|
|
|
|
## Contributor Conduct
|
|
|
|
All contributors are expected to adhere to this project's [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
|
|
## Development
|
|
|
|
### Project Vision
|
|
|
|
For clarification behind certain API design decisions, or to get up to speed on the vision of the project, check out the [API Design](./docs/api-design) pages.
|
|
|
|
### File Copyright Headers
|
|
|
|
When adding a new file to the project, add the following heading to the top of the file:
|
|
|
|
```
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the RediStack open source project
|
|
//
|
|
// Copyright (c) 2019-2020 RediStack project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of RediStack project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
```
|
|
|
|
When editing a file, ensure that the copyright header states the year `2019-<current year>`.
|
|
|
|
### Git Workflow
|
|
|
|
`master` is always the development branch.
|
|
|
|
For **minor** or **patch** SemVer changes, create a branch off of the tagged commit.
|
|
|
|
### Environment Setup
|
|
|
|
It is highly recommended to use [Docker](https://docker.com) to install Redis locally.
|
|
|
|
```bash
|
|
docker run -d -p 6379:6379 --name redis redis:5
|
|
```
|
|
|
|
Otherwise, install Redis directly on your machine from [Redis.io](https://redis.io/download).
|
|
|
|
### Submitting a Merge Request
|
|
|
|
> The easiest way to create a great merge requests is to use one of the [Merge Request Templates](./.gitlab/merge_request_templates).
|
|
|
|
A great MR that is likely to be merged quickly is:
|
|
|
|
1. Concise, with as few changes as needed to achieve the end result.
|
|
1. Tested, ensuring that regressions aren't introduced now or in the future.
|
|
1. Documented, adding API documentation as needed to cover new functions and properties.
|
|
1. Accompanied by a [great commit message](https://chris.beams.io/posts/git-commit/)
|