Fix: logx with Compress auto delete old logs (#3329)
Co-authored-by: haoran.ren <haoran.ren@mihoyo.com>
This commit is contained in:
@@ -426,7 +426,6 @@ func gzipFile(file string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer in.Close()
|
|
||||||
|
|
||||||
out, err := os.Create(fmt.Sprintf("%s%s", file, gzipExt))
|
out, err := os.Create(fmt.Sprintf("%s%s", file, gzipExt))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -441,5 +440,7 @@ func gzipFile(file string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
in.Close()
|
||||||
|
|
||||||
return os.Remove(file)
|
return os.Remove(file)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user