Golang logger,Integrate logrus and sentry,support logroate
default log out to os.Stderr
import "github.com/goapt/logger"
func main(){
logger.Debug("debug printer %s","hehe")
logger.Fatal("exit")
}
logger.Setting(func(c *logger.Config) {
c.LogMode = "file"
c.LogLevel = "info"
c.LogMaxFiles = 15 //store for up to 15 days
c.LogPath = "/tmp/logs/"
c.LogSentryDSN = ""
c.LogSentryType = ""
c.LogDetail = true
})
log := logger.NewLogger(func(c *logger.Config) {
c.LogMode = "file"
c.LogLevel = "info"
c.LogMaxFiles = 15 //store for up to 15 days
c.LogPath = "/tmp/logs/"
c.LogSentryDSN = ""
c.LogSentryType = ""
})
log.Debug("this is new log")
if LogDetail
is true,the log data add filename and line no
{"file":"/Users/fifsky/wwwroot/go/library/src/github.com/fifsky/goblog/handler/index.go","func":"handler.IndexGet","level":"debug","line":16,"msg":"[test]","time":"2018-08-02 22:37:02"}
logger.Data(map[string]interface{}{
"id": 1,
"name": "test",
}).Info("[CURL ERROR]", "123123")
{"data":{"id":1,"name":"test"},"level":"info","msg":"[CURL ERROR]123123","time":"2019-01-18 17:05:17"}