mirror of
https://github.com/go-gitea/gitea
synced 2025-07-13 14:07:20 +00:00
Pause, Resume, Release&Reopen, Add and Remove Logging from command line (#11777)
* Make LogDescriptions race safe * Add manager commands for pausing, resuming, adding and removing loggers Signed-off-by: Andrew Thornton <art27@cantab.net> * Placate lint * Ensure that file logger is run! * Add support for smtp and conn Signed-off-by: Andrew Thornton <art27@cantab.net> * Add release-and-reopen Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
@ -249,6 +249,19 @@ func (log *FileLogger) Flush() {
|
||||
_ = log.mw.fd.Sync()
|
||||
}
|
||||
|
||||
// ReleaseReopen releases and reopens log files
|
||||
func (log *FileLogger) ReleaseReopen() error {
|
||||
closingErr := log.mw.fd.Close()
|
||||
startingErr := log.StartLogger()
|
||||
if startingErr != nil {
|
||||
if closingErr != nil {
|
||||
return fmt.Errorf("Error during closing: %v Error during starting: %v", closingErr, startingErr)
|
||||
}
|
||||
return startingErr
|
||||
}
|
||||
return closingErr
|
||||
}
|
||||
|
||||
// GetName returns the default name for this implementation
|
||||
func (log *FileLogger) GetName() string {
|
||||
return "file"
|
||||
|
Reference in New Issue
Block a user