Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Debug特性

Debug/Debugf是非常有用的几个方法,用于调试信息的记录,常用于开发/测试环境中,当应用上线之后可以方便地使用SetDebug进行开启或者配置文件进行开启/关闭。

package main

import (
    "time"
    "github.com/gogf/gf/os/glog"
    "github.com/gogf/gf/os/gtime"
)

func main() {
    gtime.SetTimeout(3*time.Second, func() {
        glog.SetDebug(false)
    })
    for {
        glog.Debug(gtime.Datetime())
        time.Sleep(time.Second)
    }
}

...