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 ")
}

你可能感兴趣的:(go)