示例#1
0
文件: tslog.go 项目: sunvim/codelab
func main() {

	log.SetLevel(log.DEBUG)
	log.SetRollingDaily("./log", "test.log")
	log.Info("test")
	var t int = 4
	log.Info("t before:", t)
	t -= 1
	log.Info("t after:", t)
}
示例#2
0
func main() {

	log.SetLevel(log.DEBUG)
	log.SetRollingDaily("./", "tcp.log")

	listen, err := net.ListenTCP("tcp", &net.TCPAddr{net.ParseIP(ip), port, ""})
	if err != nil {
		fmt.Println("监听端口失败:", err.Error())
		return
	}
	log.Info("等待客户端连接,port:", port)
	Server(listen)
}
示例#3
0
文件: etc.go 项目: sunvim/logd
func init() {
	//check self log dir & store other log dir
	fi, err := os.Stat("./log")
	if err != nil {
		os.Mkdir("./log", 0666)
	} else {
		if !fi.IsDir() {
			os.Mkdir("./log", 0666)
		}
	}
	log.SetLevel(log.DEBUG)
	log.SetRollingDaily("./log", "s.log")
}