mirror of
https://git.sr.ht/~ashkeel/strimertul
synced 2024-09-30 02:40:33 +00:00
16 lines
324 B
Go
16 lines
324 B
Go
package utils
|
|
|
|
import (
|
|
"io"
|
|
"reflect"
|
|
"runtime/debug"
|
|
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
func Close(res io.Closer, logger *zap.Logger) {
|
|
err := res.Close()
|
|
if err != nil {
|
|
logger.Error("Could not close resource", zap.String("name", reflect.TypeOf(res).String()), zap.Error(err), zap.String("stack", string(debug.Stack())))
|
|
}
|
|
}
|