1
0
Fork 0
mirror of https://git.sr.ht/~ashkeel/strimertul synced 2024-09-30 02:40:33 +00:00
strimertul/utils/deferlogger.go
2024-03-16 01:20:15 +01:00

17 lines
334 B
Go

package utils
import (
"io"
"log/slog"
"reflect"
"runtime/debug"
"git.sr.ht/~ashkeel/strimertul/log"
)
func Close(res io.Closer) {
err := res.Close()
if err != nil {
slog.Error("Could not close resource", slog.String("name", reflect.TypeOf(res).String()), slog.String("stack", string(debug.Stack())), log.Error(err))
}
}