-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdebug.go
More file actions
32 lines (27 loc) · 746 Bytes
/
debug.go
File metadata and controls
32 lines (27 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package gig
import (
"fmt"
"io"
"os"
"strings"
)
var (
// DefaultWriter is the default io.Writer used by gig for debug output and
// middleware output like Logger() or Recovery().
// Note that both Logger and Recovery provides custom ways to configure their
// output io.Writer.
// To support coloring in Windows use:
// import "github.com/mattn/go-colorable"
// gig.DefaultWriter = colorable.NewColorableStdout()
DefaultWriter io.Writer = os.Stdout
// Debug enables gig to print its internal debug messages.
Debug = true
)
func debugPrintf(format string, values ...interface{}) {
if Debug {
if !strings.HasSuffix(format, "\n") {
format += "\n"
}
fmt.Fprintf(DefaultWriter, "[gig-debug] "+format, values...)
}
}