Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Go

Idiom #253 Print stack trace

Print the stack frames of the current execution thread of the program.

import "runtime/debug"
debug.PrintStack()

Prints to standard error
import GHC.Stack
msgStacktraced :: HasCallStack => String -> IO ()
msgStacktraced msg = putStrLn (msg ++ "\n" ++ prettyCallStack callStack)

New implementation...
< >
programming-idioms.org