nim-eth/eth/trie/db_tracing.nim

26 lines
579 B
Nim
Raw Permalink Normal View History

2019-02-05 12:01:10 +00:00
const
db_tracing* {.strdefine.} = "off"
var
dbTracingEnabled* = true
when db_tracing in ["on", "1"]:
import nimcrypto/utils
template traceGet*(k, v) =
if dbTracingEnabled:
echo "GET ", toHex(k), " = ", toHex(v) # rlpFromBytes(v).inspect
2019-02-05 12:01:10 +00:00
template tracePut*(k, v) =
if dbTracingEnabled:
echo "PUT ", toHex(k), " = ", toHex(v) # rlpFromBytes(v).inspect
2019-02-05 12:01:10 +00:00
template traceDel*(k) =
if dbTracingEnabled:
echo "DEL ", toHex(k)
else:
template traceGet*(k, v) = discard
template tracePut*(k, v) = discard
template traceDel*(k) = discard