Beispiel #1
0
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)
}
Beispiel #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)
}
Beispiel #3
0
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")
}