summaryrefslogtreecommitdiffstats
path: root/modules/log/console.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-07-06 01:07:07 +0100
committerGitHub <noreply@github.com>2020-07-05 20:07:07 -0400
commitc5b08f6d5a73e6ba84da84e804d05a8dd3d651be (patch)
tree7e0f72b9c62b8764d000614714c91a01ebbee223 /modules/log/console.go
parent38fb087d1983ca8320fb1a8c90150ae7956b358d (diff)
downloadgitea-c5b08f6d5a73e6ba84da84e804d05a8dd3d651be.tar.gz
gitea-c5b08f6d5a73e6ba84da84e804d05a8dd3d651be.zip
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>
Diffstat (limited to 'modules/log/console.go')
-rw-r--r--modules/log/console.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/log/console.go b/modules/log/console.go
index 6cfca8a733..a805021f0b 100644
--- a/modules/log/console.go
+++ b/modules/log/console.go
@@ -68,6 +68,20 @@ func (log *ConsoleLogger) Init(config string) error {
func (log *ConsoleLogger) Flush() {
}
+// ReleaseReopen causes the console logger to reconnect to os.Stdout
+func (log *ConsoleLogger) ReleaseReopen() error {
+ if log.Stderr {
+ log.NewWriterLogger(&nopWriteCloser{
+ w: os.Stderr,
+ })
+ } else {
+ log.NewWriterLogger(&nopWriteCloser{
+ w: os.Stdout,
+ })
+ }
+ return nil
+}
+
// GetName returns the default name for this implementation
func (log *ConsoleLogger) GetName() string {
return "console"