-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmode.go
More file actions
42 lines (36 loc) · 623 Bytes
/
mode.go
File metadata and controls
42 lines (36 loc) · 623 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
33
34
35
36
37
38
39
40
41
42
package tclientlib
import (
"log"
)
const (
DebugMode = "debug"
NoPrintMode = "no print"
)
const (
debugCode = iota
noPrintCode
)
var currentMode = noPrintCode
func SetMode(value string) {
switch value {
case DebugMode, "":
currentMode = debugCode
case NoPrintMode:
currentMode = noPrintCode
default:
panic("unknown mode" + value)
}
if value == "" {
value = DebugMode
}
}
func traceLog(values ...interface{}) {
if currentMode == debugCode {
log.Println(values...)
}
}
func traceLogf(format string, values ...interface{}) {
if currentMode == debugCode {
log.Printf(format, values...)
}
}