package l_export_async import "fmt" type LogTool interface { Errorf(format string, a ...interface{}) Infof(format string, a ...interface{}) } type LogPrint struct { tool LogTool } func NewLogPrint(tool LogTool) LogTool { return &LogPrint{tool: tool} } func (r *LogPrint) Errorf(format string, a ...interface{}) { if r.tool != nil { r.tool.Errorf(format, a...) return } fmt.Printf(format, a...) } func (r *LogPrint) Infof(format string, a ...interface{}) { if r.tool != nil { r.tool.Infof(format, a...) return } fmt.Printf(format, a...) }