Skip to content

Commit fb3fb3e

Browse files
committed
Add Linux os check for setting some JSONDecoder options
1 parent f91900a commit fb3fb3e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sources/JSONLogger.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,20 @@ public struct JSONLogger : LogHandler {
5555
encoder.dataEncodingStrategy = .base64
5656
encoder.nonConformingFloatEncodingStrategy = .throw
5757
let decoder = JSONDecoder()
58+
/* #if os(Darwin) is not available on this version of the compiler. */
59+
#if !os(Linux)
5860
if #available(macOS 12.0, tvOS 15.0, iOS 15.0, watchOS 8.0, *) {
5961
decoder.allowsJSON5 = false
6062
}
63+
#endif
6164
decoder.keyDecodingStrategy = .useDefaultKeys
6265
decoder.dateDecodingStrategy = .iso8601
6366
decoder.dataDecodingStrategy = .base64
67+
#if !os(Linux)
6468
if #available(macOS 12.0, tvOS 15.0, iOS 15.0, watchOS 8.0, *) {
6569
decoder.assumesTopLevelDictionary = false
6670
}
71+
#endif
6772
decoder.nonConformingFloatDecodingStrategy = .throw
6873
return (encoder, decoder)
6974
}()

0 commit comments

Comments
 (0)