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

15 lines
294 B
Go

package utils
import (
"io"
"log/slog"
"reflect"
"runtime/debug"
)
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())), "error", err)
}
}