package flogger
import (
"encoding/json"
"log"
)
type Flogger struct {
PrintDebug bool
}
func (m *Flogger) Debug(args ...interface{}) {
if m.PrintDebug {
m.print(args...)
}
}
func (m *Flogger) Debugf(format string, args ...interface{}) {
if m.PrintDebug {
log.Printf(format, args...)
}
}
func (m *Flogger) print(args ...interface{}) {
log.Print(args...)
}
func (m *Flogger) PrintJson(query interface{}) {
if m.PrintDebug {
// 输出聚合成JSON
b, _ := json.Marshal(query)
m.Debug(string(b))
}
}
go 控制台输出打印
于 2021-05-26 11:53:54 首次发布
469

被折叠的 条评论
为什么被折叠?



