Golang记录中的警告和警告之间有什么区别?
问题描述:
In logrus official doc, it just says below:
func Warn
func Warn(args ...interface{})
Warn logs a message at level Warn on the standard logger.
func Warning
func Warning(args ...interface{})
Warning logs a message at level Warn on the standard logger.
It looks like it's almost the same. Which one should I prefer to use?
在logrus官方文档中,内容如下: p>
func Warn
func Warn(args ... interface {})
Warn在标准记录器上以Warn级别记录消息。
func Warning
func Warning(args ... interface {})
Warning在以下位置记录消息 级别在标准记录器上发出警告。
code> pre>
看起来几乎一样。 我应该使用哪一个? p>
div>
答
Both Warn and Warning are the same.
Check this https://github.com/sirupsen/logrus/blob/e4b0c6d7829bcf64435536c4a88f4088a3c76203/logrus.go#L44
Either of that two are ok but be consistent and use the same each time.
I use Warn because is shorter :)