go language logging library simple use method example analysis

  • 2020-05-26 09:20:41
  • OfStack

This article illustrates the simple use of the go language logging library. Share with you for your reference. The specific implementation method is as follows:

package main
import (
func main(){
 logfile,err := os.OpenFile("/var/golang/ofstack.com.log",os.O_RDWR|os.O_CREATE,0);
 if err!=nil {
 defer logfile.Close();
 logger := log.New(logfile,"\r\n",log.Ldate|log.Ltime|log.Llongfile);

I hope this article has been helpful to your programming of Go language.

Related articles: