thomas-tacquet / gormv2-logrus Goto Github PK
View Code? Open in Web Editor NEWEasily connect Gorm V2 and logrus with customizable options
License: MIT License
Easily connect Gorm V2 and logrus with customizable options
License: MIT License
require (
github.com/coreos/go-systemd/v22 v22.5.0
github.com/gin-gonic/gin v1.9.1
github.com/sirupsen/logrus v1.9.3
github.com/thomas-tacquet/gormv2-logrus v1.2.2
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gorm.io/driver/mysql v1.5.1
gorm.io/gorm v1.25.1
)
gormLogger := gormv2logrus.NewGormlog(
gormv2logrus.WithLogrus(l),
gormv2logrus.WithGormOptions(
gormv2logrus.GormOptions{
SlowThreshold: slowThresholdDuration,
LogLevel: logger.Info,
LogLatency: true,
},
),
)
gormr, err := gorm.Open(mysql.New(mysql.Config{
Conn: db,
}), &gorm.Config{
Logger: gormLogger,
TranslateError: true,
NamingStrategy: schema.NamingStrategy{
SingularTable: true, // Use singular table names
},
})
logger.Default.LogMode(logger.Silent)
it works fine, but output is console@thomas-tacquet
We are using LogStash to parse and store all our app logs, but due to the logs format there is some challenges :
For the Colorful Option, there are many options to add this in Logrus options (such as red for duration parameter, blue for rows parameters). We need to use this way to add Colorful option
Hi, is this package already production ready or still under heavy development?
Hi @thomas-tacquet ,
I'm looking to use this library to use Logrus as Gorm logger, but I didn't find how to modify the options, because none of the functions allowing it do not seem to be exported
The operation does not look usual, is it an error not to have exported the option
structure or the newGormLogOption
function ?
Maybe a small piece of doc to, for example, change the value of the logLatency
parameter ?
KIndly,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.