1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-06-16 04:24:56 +02:00

app/log/RotatingFile.go: Adding GetFilename()

This commit is contained in:
Henrik Hautakoski 2023-05-16 17:50:15 +02:00
parent 03ab664130
commit 89f47c06df

View file

@ -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)