ensure that cfg.LogTo
is properly closed on disconnect if its underlying type is a file
This commit is contained in:
parent
bb5d6e6db3
commit
74f32a5352
@ -121,6 +121,9 @@ func (e *Engine) logSql(msg, sql string) {
|
|||||||
// Disconnect - closes and disposes of this Engine's connection pool.
|
// Disconnect - closes and disposes of this Engine's connection pool.
|
||||||
func (e *Engine) Disconnect() {
|
func (e *Engine) Disconnect() {
|
||||||
e.conn.Close()
|
e.conn.Close()
|
||||||
|
if asFile, ok := e.cfg.LogTo.(*os.File); ok {
|
||||||
|
_ = asFile.Close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open - creates a new connection according to `connString`
|
// Open - creates a new connection according to `connString`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user