Skip to content

weidongkl/logrus-formatter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logrus-formatter

The formatter of logrus, like python's logging.

[INFO] 2023-05-30 05:59:28,99  [xx.go:40]:  messags

Installation

go get gitee.com/weidongkl/logrus-formatter

Usage

package main

import (
	formatter "gitee.com/weidongkl/logrus-formatter"
	"github.com/sirupsen/logrus"
)

func main() {
	log := logrus.New()
	log.SetReportCaller(true)
	log.SetFormatter(&formatter.Formatter{})
	log.Infoln("test messages")
}

For advanced usage, please refer to example

About

Defining Logrus log format to include file and line number

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages