Rotate causes Logger to close the existing log file and immediately create a new one. This is a helper function for applications that want to initiate rotations outside of the normal rotation rules, such as in response to SIGHUP. After rotating, this initiates compression and removal of old log fi
()
| 184 | // SIGHUP. After rotating, this initiates compression and removal of old log |
| 185 | // files according to the configuration. |
| 186 | func (l *Logger) Rotate() error { |
| 187 | l.mu.Lock() |
| 188 | defer l.mu.Unlock() |
| 189 | return l.rotate() |
| 190 | } |
| 191 | |
| 192 | // rotate closes the current file, moves it aside with a timestamp in the name, |
| 193 | // (if it exists), opens a new file with the original filename, and then runs |