Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SQLWriter ¶
type SQLWriter struct {
log.BatchSupport
log.FilterSupport
Driver string
Dsn string
Statement string
ConnMaxIdleTime time.Duration
ConnMaxLifeTime time.Duration
// contains filtered or unexported fields
}
SQLWriter implements log Writer Interface and batch send log messages to database. Prepare:
CREATE TABLE logs ( id serial NOT NULL, time timestamp with time zone NOT NULL, level char(1) NOT NULL, msg text NOT NULL, file text NOT NULL, line integer NOT NULL, func text NOT NULL, trace text NOT NULL);
Driver: postgres Dsn: host=127.0.0.1 user=pango password=pango dbname=pango port=5432 sslmode=disable Statement: "INSERT INTO sqlogs (time, level, msg, file, line, func, trace) VALUES" Parameter: "%t %p %m %S %L %F %T"
func (*SQLWriter) SetConnMaxIdleTime ¶
SetConnMaxIdleTime set ConnMaxIdleTime
func (*SQLWriter) SetConnMaxLifeTime ¶
SetConnMaxLifeTime set ConnMaxLifeTime
func (*SQLWriter) SetParameter ¶
SetParameter set sql statement parameter %t: event time %c: logger name %p: log level prefix %l: log level string %x{key}: logger property %S: caller source file name %L: caller source line number %F: caller function name %T: caller stack trace %m: message %M{msg}: custom message