status-im / nim-chronicles

A crafty implementation of structured logging for Nim.
Apache License 2.0
153 stars 20 forks source link

`logScope` doesn't preserve order of fields #108

Open arnetheduck opened 2 years ago

arnetheduck commented 2 years ago
INF 2022-01-03 16:57:11.631+01:00 State replayed                             topics="chaindag" ancestor=874fd407:2866783 targetStateRoot=2fc2f5f3 slots=33 target=874fd407:2866783@2866816 replayDur=307ms49us379ns blocks=0 current=c60f4822:2866762@2866784 found=true assignDur=4ms771us220ns ancestorStateRoot=0b37c3e6
  logScope:
    blocks = ancestors.len
    slots = getStateField(state.data, slot) - ancestor.slot
    current = shortLog(current)
    ancestor = shortLog(ancestor)
    target = shortLog(bs)
    ancestorStateRoot = shortLog(ancestorRoot)
    targetStateRoot = shortLog(getStateRoot(state.data))
    found
    assignDur
    replayDur

the ordering of the fields should be preserved as it matters for the user experience