From 6b9d7f7df28d318a28dde3adb8a5e9ae9bf1abaf Mon Sep 17 00:00:00 2001 From: chressie Date: Wed, 9 Aug 2023 10:22:17 +0200 Subject: [PATCH] glog: populate symlinks -log_link directory (#64) This was reported in https://groups.google.com/g/golang-nuts/c/Fh9o3CPjIIw/m/TyiUDY2uAAAJ. --- glog_file.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/glog_file.go b/glog_file.go index a2e8439b..e7d125c5 100644 --- a/glog_file.go +++ b/glog_file.go @@ -132,6 +132,11 @@ func create(tag string, t time.Time) (f *os.File, filename string, err error) { symlink := filepath.Join(dir, link) os.Remove(symlink) // ignore err os.Symlink(name, symlink) // ignore err + if *logLink != "" { + lsymlink := filepath.Join(*logLink, link) + os.Remove(lsymlink) // ignore err + os.Symlink(fname, lsymlink) // ignore err + } return f, fname, nil } lastErr = err