From 89f47c06df447cd135e09df65ded307f60c020a4 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Tue, 16 May 2023 17:50:15 +0200 Subject: [PATCH] app/log/RotatingFile.go: Adding GetFilename() --- app/log/RotatingFile.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/log/RotatingFile.go b/app/log/RotatingFile.go index 75fb813..7c22c14 100644 --- a/app/log/RotatingFile.go +++ b/app/log/RotatingFile.go @@ -58,6 +58,10 @@ func (w *RotatingFile) newFilename(name string) string { return fmt.Sprintf("%s-%s%s", name, time.Now().Format(w.format), ext) } +func (w RotatingFile) GetFilename() string { + return path.Base(w.fd.Name()) +} + // Rotate the file. func (w *RotatingFile) Rotate() error { dst, err := os.OpenFile(w.newFilename(w.fd.Name()), os.O_CREATE|os.O_WRONLY, 0o666)