Documentation ¶
Overview ¶
Package flagtrace provides easy tracing of the program (using runtime/trace) by enabling a command-line flag.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
Register registers a flag to enable tracing with runtime/trace.
The returned func must be run defered to stop the tracing and close the file.
When tracing is enabled, a handler for SIGINT (^C) is also registered to properly stop tracing and close the file.
Example ¶
package main import ( "flag" "fmt" "github.com/dolmen-go/flagx/flagtrace" ) func main() { stopTracing := flagtrace.Register(flag.CommandLine, "debug.trace", "trace `file` (for go tool trace)") defer stopTracing() flag.Parse() fmt.Println("hello, world!") }
Output: hello, world!
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.