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
motivation: since Error in swift does not carry any additional information (such as stack traces) that can be useful in formatting decision the LogHandler may need to do, there is no real reason to treat it as special in the API, and it can just be "strigified" at the calling site
changes: remove error params from all APIs
motivation: make the API flexible enough so that users that need to inject custom factories as an escape hatch can do that
changes: add a Logging::make API variant that takes a custom factory instead of the default one
This has numerous benefits, most of which center around values which may
have expensive to perform custom `description` implementations, e.g.
yet are neither a dictionary nor an array.
It also allows carrying and thus "delaying" rendering of string
representations until they are actually needed. E.g. one can imagine
wanting to avoid rendering a string representation of a value if a
logger never would log any of the metadata, esp. if the rendering is a
heavy process.
motivation: better example
changes: the exmaple is single threaded, but better to show how to properly use global loggers (although we discourage them)