go 追加日志功能



package main
import (
    "log"
    "os"
)
func main(){
     f, err := os.OpenFile("bbb.log",  os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
   if err != nil{
    log.Fatalln("HHHHH")
   } 
   debugLog := log.New(f,"[Info]",log.Llongfile)
    debugLog.Println("A Info message here")
    debugLog.SetPrefix("[Debug]")
    debugLog.Println("f Debug Message here ")
}

猜你喜欢

转载自blog.csdn.net/DDFFR/article/details/79257099