Stacky ☆ BEAM stack trace in Gleam
A stack trace of stack frames with module name, function name, arity, file name and line number!
Installation
gleam add stacky
Usage
let stacktrace = stacky.trace()
io.print("\n")
io.println("Trace to string:")
stacktrace
|> stacky.print_trace
io.print("\n")
io.println("Frame with context:")
stackframe
|> stacky.print_frame_with(context: #("my_context"))
stdout
example:
Trace to string:
#6 - stacky/internal/example.main - /0 - SOME_PATH/stacky/build/dev/erlang/stacky/_gleam_artefacts/stacky@internal@example.erl:8
#5 - gleam entrypoint | stacky@@main.run - /1 - SOME_PATH/stacky/build/dev/erlang/stacky/_gleam_artefacts/stacky@@main.erl:11
#4 - erl_eval.do_apply - /7 - erl_eval.erl:746
#3 - init.start_it - /1
#2 - init.start_em - /1
#1 - init.do_boot - /3
Frame with context:
#6 - stacky/internal/example.main - /0 - SOME_PATH/stacky/build/dev/erlang/stacky/_gleam_artefacts/stacky@internal@example.erl:8
with context: #("my_context")
Demo
gleam run --module stacky/internal/sub_dir/example_in_sub_dir
Further documentation can be found at https://hexdocs.pm/stacky.