Improve distinction between debugging stacktraces and crash/exception stacktraces

This commit is contained in:
Mamy André-Ratsimbazafy 2019-03-26 10:56:23 +01:00 committed by zah
parent e8160c2126
commit d1f75cdfef
2 changed files with 17 additions and 2 deletions

View File

@ -2,7 +2,8 @@ import
tables, sets, macros, base64,
chronos, nimcrypto/sysrand, chronicles, json_serialization,
eth/[p2p, rlp], eth/p2p/[rlpx, peer_pool],
spec/[datatypes, crypto]
spec/[datatypes, crypto],
tracing/stacktraces
type
TopicMsgHandler = proc (msg: string)
@ -38,7 +39,9 @@ p2pProtocol GossipSub(version = 1,
onPeerDisconnected do (peer: Peer, reason: DisconnectionReason):
info "GossipSub Peer disconnected", peer, reason
writeStackTrace()
debug "Debugging stacktrace"
writeStyledStackTrace()
debug "Continuing ..."
proc subscribeFor(peer: Peer, topic: string) =
peer.state.subscribedFor.incl topic

View File

@ -0,0 +1,12 @@
# beacon_chain
# Copyright (c) 2018-2019 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
import terminal
proc writeStyledStackTrace*() =
let st = getStackTrace()
writeStyled st, style = {styleBright, styleItalic}