Open MichaelXavier opened 8 years ago
I can provide some notes on the CallStack
api. There you only get callstacks (i.e. more than one location) once you change the type signature of the calling functions that you want to include in the stack. So you will get more detailed call stacks when you explicitly enable it.
Oh and re 2: multi-line logs are painful. Please just truncate the call stack in that case.
Very cool to see folks using the implicit call-stacks in the real world! Feel free to ping me if you have any questions.
Re 2: you can also use getCallStack
to extract a list of call-sites ([(String, SrcLoc)]
) and produce your own, machine-friendly serialization. showCallStack
is really just intended for human-friendly output (and has recently been renamed to prettyCallStack
to make that clear).
FWIW I investigated this idea for a similar library (bugsnag) and it proved not very useful because of how CallStack history can get cleaved if there's a missing constraint in-between. We're going to reuse the TH + ?loc
approach for now.
This might actually be a good use case for http://hackage.haskell.org/package/base-4.12.0.0/docs/GHC-ExecutionStack.html - I had a quick discussion with @bgamari on #ghc today.
The drawback is that this only works on Linux and with DWARF debugging symbols enabled(which I'd recommend anyone to enable anyway if you can risk the binary size).
Formatting per each scribe is tricky, JSON based scribes can just do [(String, SrcLoc)]
and stderr
scribe could do some multi-line pretty printing.
Anway, Ben is doing a talk about this at MuniHac so let's wait another three days :)
On November 14, 2018 3:16:03 PM EST, "Domen Kožar" notifications@github.com wrote:
This might actually be a good use case for http://hackage.haskell.org/package/base-4.12.0.0/docs/GHC-ExecutionStack.html
- I had a quick discussion with @bgamari on #ghc today.
The drawback is that this only works on Linux and with DWARF debugging symbols enabled(which I'd recommend anyone to enable anyway if you can risk the binary size).
Formatting per each scribe is tricky, JSON based scribes can just do
[(String, SrcLoc)]
andstderr
scribe could do some multi-line pretty printing.Anway, Ben is doing a talk about this at MuniHac so let's wait another three days :)
Sorry, to be clear I will be speaking about another topic at Munihac. I'm afraid the DWARF talk will need to wait until another venue.
Thanks @bgamari, misunderstood you then.
This springs out of the #18 PR: Currently our logging has the concept of a location of the log statement, but cannot support log stacks. If we did something like changing the type to
Maybe (NonEmpty Loc)
, then both the current location and a callstack could be representable. A couple initial thoughts: