Skip to content

Commit 4bed75e

Browse files
committed
Add some doc about the coders for the logger
1 parent d2db183 commit 4bed75e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Sources/JSONLogger.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ import Logging
3333
(Note I’m not sure why `json-seq` does not do that but there must be a good reason.
3434
Probably because the resulting output would not be valid UTF-8 anymore.)
3535

36-
The output file descriptor is also customizable and is `stdout` by default. */
36+
The output file descriptor is also customizable and is `stdout` by default.
37+
38+
Finally, the JSON coders are customizable too.
39+
There is a `JSONEncoder` that create the JSON from a ``LogLine`` entry, which is the struct created internally for any logged line.
40+
There is also an optional `(JSONEncoder, JSONDecoder)` tuple which is used specifically to get structured metadata from any object in the metadata.
41+
42+
All of the JSON output from this logger should be parsable as a ``LogLine`` by a `JSONDecoder` matching the config of the `JSONEncoder` set in the config of the logger. */
3743
public struct JSONLogger : LogHandler {
3844

3945
public static let defaultJSONEncoder: JSONEncoder = {

0 commit comments

Comments
 (0)