import "github.com/dizitart/trace"
const ( // Switches off other information in trace message PRINT_NONE MessageFormat = 0 // Switch to print time PRINT_TIME MessageFormat = 1 // Switch to print function name PRINT_PROC MessageFormat = 2 // Switch to print source file name PRINT_FILE MessageFormat = 4 // Switch yo print current line number PRINT_LINE MessageFormat = 8 // Switches on all formatting PRINT_ALL MessageFormat = PRINT_TIME | PRINT_PROC | PRINT_FILE | PRINT_LINE // Switches off printing OUT_NONE OutputChannel = 0 // Switch to print to Stdout OUT_STD OutputChannel = 1 // Switch to print to File OUT_FILE OutputChannel = 2 // Switches on both File & Stdout printing OUT_ALL OutputChannel = OUT_STD | OUT_FILE )
var ( // Flag to enable or disable the Tracing ENABLE_TRACE bool = false // Trace log file path TRACE_FILE_PATH string )
Use these configuration variables to set tracing parameters
Checks for a condition; if the condition is false, writes a trace message that shows the call stack.
Checks for a condition; if the condition is false, writes a specified message after formatting it according to a format specifier that shows the call stack.
func SetMessageFormat(messageFormat MessageFormat)
Sets trace message format
func SetOut(out OutputChannel)
Sets output channels (Stdout, File)
func Write(variable interface{})
Writes information about current source file, line number and input variable
Writes information about current source file, line number and input variable after formatting it according to a format specifier
Package trace imports 6 packages (graph). Updated 2018-03-22. Refresh now. Tools for package owners.