trace: github.com/dizitart/trace Index | Files

package trace

import "github.com/dizitart/trace"

Index

Package Files

trace.go

Constants

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
)

Variables

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

func Assert Uses

func Assert(condition bool)

Checks for a condition; if the condition is false, writes a trace message that shows the call stack.

func Assertf Uses

func Assertf(condition bool, format string, variables ...interface{})

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 Uses

func SetMessageFormat(messageFormat MessageFormat)

Sets trace message format

func SetOut Uses

func SetOut(out OutputChannel)

Sets output channels (Stdout, File)

func Write Uses

func Write(variable interface{})

Writes information about current source file, line number and input variable

func Writef Uses

func Writef(format string, variables ...interface{})

Writes information about current source file, line number and input variable after formatting it according to a format specifier

type MessageFormat Uses

type MessageFormat byte

type OutputChannel Uses

type OutputChannel byte

Package trace imports 6 packages (graph). Updated 2018-03-22. Refresh now. Tools for package owners.