A suitable hook using the database/sql
package would look something like:
type dbHook struct {
*sql.DB
}
func (db dbHook) Fire(e *logrus.Entry) error {
_, err := db.Exec("insert into log (time, level, message) values (?, ?, ?)",
e.Time,
e.Level,
e.Message,
)
return err
}
Hopefully this is enough to get you started.