Refine log output

This commit is contained in:
世界
2022-07-04 16:45:32 +08:00
parent 616b599104
commit c33a079c88
5 changed files with 159 additions and 55 deletions

View File

@@ -27,7 +27,11 @@ type abstractLogrusLogger interface {
func NewLogrusLogger(options option.LogOption) (*logrusLogger, error) {
logger := logrus.New()
logger.SetLevel(logrus.TraceLevel)
logger.Formatter.(*logrus.TextFormatter).ForceColors = true
logger.SetFormatter(&LogrusTextFormatter{
DisableColors: options.DisableColor || options.Output != "",
DisableTimestamp: !options.Timestamp && options.Output != "",
FullTimestamp: options.Timestamp,
})
logger.AddHook(new(logrusHook))
var err error
if options.Level != "" {