Fix log topics (#14)

adds serde log topics

moves `logScope` into routine scope due to a bug in chronicles
This commit is contained in:
Ben Bierens 2024-04-26 10:25:02 +02:00 committed by GitHub
parent 0b29da6e98
commit a4a6b0d949
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View File

@ -27,9 +27,6 @@ export types
{.push raises: [].} {.push raises: [].}
logScope:
topics = "json deserialization"
template expectJsonKind( template expectJsonKind(
expectedType: type, expectedKinds: set[JsonNodeKind], json: JsonNode expectedType: type, expectedKinds: set[JsonNodeKind], json: JsonNode
) = ) =
@ -188,6 +185,10 @@ proc fromJson*[T: ref object or object](_: type T, json: JsonNode): ?!T =
let isOptionalValue = typeof(value) is Option let isOptionalValue = typeof(value) is Option
var skip = false # workaround for 'continue' not supported in a 'fields' loop var skip = false # workaround for 'continue' not supported in a 'fields' loop
# logScope moved into proc due to chronicles issue: https://github.com/status-im/nim-chronicles/issues/148
logScope:
topics = "serde json deserialization"
case mode case mode
of Strict: of Strict:
if opts.key notin json: if opts.key notin json:

View File

@ -20,9 +20,6 @@ export types
{.push raises: [].} {.push raises: [].}
logScope:
topics = "json serialization"
proc `%`*(s: string): JsonNode = proc `%`*(s: string): JsonNode =
newJString(s) newJString(s)
@ -99,6 +96,10 @@ proc `%`*[T: object or ref object](obj: T): JsonNode =
let hasSerialize = value.hasCustomPragma(serialize) let hasSerialize = value.hasCustomPragma(serialize)
var skip = false # workaround for 'continue' not supported in a 'fields' loop var skip = false # workaround for 'continue' not supported in a 'fields' loop
# logScope moved into proc due to chronicles issue: https://github.com/status-im/nim-chronicles/issues/148
logScope:
topics = "serde json serialization"
case mode case mode
of OptIn: of OptIn:
if not hasSerialize: if not hasSerialize: