mirror of
https://github.com/pgsty/minio.git
synced 2026-07-22 05:30:24 +03:00
add logrotate support for MinIO logs (#19641)
This commit is contained in:
+10
-12
@@ -25,7 +25,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/minio/minio/internal/color"
|
||||
c "github.com/minio/pkg/v2/console"
|
||||
"github.com/minio/pkg/v2/logger/message/log"
|
||||
)
|
||||
|
||||
@@ -99,8 +98,7 @@ func (f fatalMsg) json(msg string, args ...interface{}) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println(string(logJSON))
|
||||
|
||||
fmt.Fprintln(Output, string(logJSON))
|
||||
ExitFunc(1)
|
||||
}
|
||||
|
||||
@@ -139,16 +137,16 @@ func (f fatalMsg) pretty(msg string, args ...interface{}) {
|
||||
ansiSaveAttributes()
|
||||
// Print banner with or without the log tag
|
||||
if !tagPrinted {
|
||||
c.Print(logBanner)
|
||||
fmt.Fprint(Output, logBanner)
|
||||
tagPrinted = true
|
||||
} else {
|
||||
c.Print(emptyBanner)
|
||||
fmt.Fprint(Output, emptyBanner)
|
||||
}
|
||||
// Restore the text color of the error message
|
||||
ansiRestoreAttributes()
|
||||
ansiMoveRight(bannerWidth)
|
||||
// Continue error message printing
|
||||
c.Println(line)
|
||||
fmt.Fprintln(Output, line)
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -176,7 +174,7 @@ func (i infoMsg) json(msg string, args ...interface{}) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println(string(logJSON))
|
||||
fmt.Fprintln(Output, string(logJSON))
|
||||
}
|
||||
|
||||
func (i infoMsg) quiet(msg string, args ...interface{}) {
|
||||
@@ -184,9 +182,9 @@ func (i infoMsg) quiet(msg string, args ...interface{}) {
|
||||
|
||||
func (i infoMsg) pretty(msg string, args ...interface{}) {
|
||||
if msg == "" {
|
||||
c.Println(args...)
|
||||
fmt.Fprintln(Output, args...)
|
||||
}
|
||||
c.Printf(msg, args...)
|
||||
fmt.Fprintf(Output, msg, args...)
|
||||
}
|
||||
|
||||
type errorMsg struct{}
|
||||
@@ -209,7 +207,7 @@ func (i errorMsg) json(msg string, args ...interface{}) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println(string(logJSON))
|
||||
fmt.Fprintln(Output, string(logJSON))
|
||||
}
|
||||
|
||||
func (i errorMsg) quiet(msg string, args ...interface{}) {
|
||||
@@ -218,9 +216,9 @@ func (i errorMsg) quiet(msg string, args ...interface{}) {
|
||||
|
||||
func (i errorMsg) pretty(msg string, args ...interface{}) {
|
||||
if msg == "" {
|
||||
c.Println(args...)
|
||||
fmt.Fprintln(Output, args...)
|
||||
}
|
||||
c.Printf(msg, args...)
|
||||
fmt.Fprintf(Output, msg, args...)
|
||||
}
|
||||
|
||||
// Error :
|
||||
|
||||
Reference in New Issue
Block a user