github.com/OrigamiWang/msd/micro@v0.0.0-20240229032328-b62246268db9/util/log/logutil.go (about)

     1  package logutil
     2  
     3  import (
     4  	"github.com/jeanphorn/log4go"
     5  )
     6  
     7  // 目前的问题,不调用log4go.Close(),日志不会打印在console和文件中
     8  func init() {
     9  	log4go.LoadConfiguration("./log4go.xml", "xml")
    10  }
    11  
    12  func Info(arg0 interface{}, args ...interface{}) {
    13  	if len(args) > 0 {
    14  		log4go.Info(arg0, args...)
    15  	} else {
    16  		log4go.Info(arg0)
    17  	}
    18  }
    19  func Debug(arg0 interface{}, args ...interface{}) {
    20  	if len(args) > 0 {
    21  		log4go.Debug(arg0, args...)
    22  	} else {
    23  		log4go.Debug(arg0)
    24  	}
    25  }
    26  func Error(arg0 interface{}, args ...interface{}) {
    27  	if len(args) > 0 {
    28  		log4go.Error(arg0, args...)
    29  	} else {
    30  		log4go.Error(arg0)
    31  	}
    32  }
    33  
    34  func Warn(arg0 interface{}, args ...interface{}) {
    35  	if len(args) > 0 {
    36  		log4go.Warn(arg0, args...)
    37  	} else {
    38  		log4go.Warn(arg0)
    39  	}
    40  }