Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SQLWriter ¶
type SQLWriter struct { log.LogFilter log.BatchWriter 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 Statement: "INSERT INTO sqlogs (time, level, msg, file, line, func, trace) VALUES ($1, $2, $3, $4, $5, $6, $7)" 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
Click to show internal directories.
Click to hide internal directories.