Expose `StreamLogHandler` to the public which replaces the previously internal `StdoutLogHandlers`. Users can choose now the output stream, while `stdout` is the default.
### Motivation:
As discussed on #51 and #60
### Modifications:
Rename `StdoutLogHandler` to `StreamLogHandler` and provide 2 factory methods `standardOutput(label:)` and `standardError(label:)` for using during bootstrapping.
### Result:
Users who adopt other logging backends during `LoggingSystem` bootstrapping will still be able to use the default log handler to get very basic console output to their choice of `stdout` or `stderr`.
### Example:
```
// Log to both stderr and stdout for good measure
LoggingSystem.bootstrap {
MultiplexLogHandler([
FancyLoggingBackend(label: $0),
StreamLogHandler.standardError(label: $0),
StreamLogHandler.standardOutput(label: $0)
])
}
```
Motivation:
Users ask for a CocoaPod. Unfortunately, the CocodPod `SwiftLog` is
already taken, so I went for `SwiftLogAPI`.
Modification:
Add a podspec generator.
Result:
Happier users.
Motivation:
Allowing readers of the API documentation to drill into the implementation of documented declarations can be educational and helpful for debugging, among several other reasons.
Modifications:
Add --github-file-prefix appending the current version in order to keep stable links. This means that documentation generated from any non-release revision may resolve incorrectly. This can be refined in the doc generation script later if it is deemed problematic by resolving to the commit sha if it doesn't exactly align with the version.
Result:
Users will be able to click a 'Show on GitHub' for all documented API declarations.
motivation: use consistent formatting
changes: update generate_linux_tests to match the formatting rules we use: `swiftformat --self insert --patternlet inline --stripunusedargs unnamed-only --comments ignore`
The original issue that was https://bugs.swift.org/browse/SR-9687 has been closed as duplicate of https://bugs.swift.org/browse/SR-9686
Perhaps it would be less confusing for others reading the code if we linked to the not-closed issue?
Not a big deal, just something I noticed; if we want to continue to link to the original issue that's fine too.
Motivation:
Logger had two ways to access the metadata:
logger[metadataKey: "foo"] = "bar"
and
logger.metadata["foo"] = "bar"
. The first one is the preferred API (as it doesn't force the
`LogHandler`s to store it in a dictionary) but the second one was still
available for cases where you need to import/export the whole metadata
storage.
Instead of exposing this as a dictionary, we should make the
'whole-metadata import/export' opaque. We're close to tagging 1.0.0
however let's design this API properly and add a sensible implementation
for 1.1.0 or so.
Moditications:
remove `Logger.metadata` property
Result:
- We can design the import/export APIs and add them when they're ready.
- the `LogHandler` API is unchanged
Motivation:
The syslog log level was unnatural in order (`.error` < `.info`) but also
didn't have `.trace` and instead the odd `.emergency` and `.alert`.
Modification:
As per https://forums.swift.org/t/logging-levels-for-swifts-server-side-logging-apis-and-new-os-log-apis/20365/56 ,
we decided to go for
trace < debug < info < notice < warning < error < critical
and also remove the integrals completely. The levels remain comparable
though.
Result:
log levels more natural
Motivation:
Correct `LogHandler` implementation is very imprortant for a working
swift-log ecosystem. Treating the `logLevel` as a value has lead to
confusion in the discussion leading to this project though.
Modification:
- add documentation on the implementation of a `LogHandler`
- move `LogHandler` to its own file
- add a unit test showcasing a global log level override
Result:
better docs
Motivation:
With the new, awesome Swift 5 `String`s, there doesn't seem to be any
point in using `StaticString`s anymore. `String` seems to use immortal
strings for literals now and is in fact 1 byte less wide than
StaticString.
Modification:
Switch all StaticString for String
Result:
better asm (slightly shorter), fewer registers burnt, more features
motivation: prepare to release
changes:
* add docker setup
* fix tests to pass correctly on linux
* add sanity scripts to make sure linux tests are present
* add doc generation scripts
* fix few naming mistakes in collateral