mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
feat(retention): added image retention policies (#1866)
feat(metaDB): add more image statistics info Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
+10
-6
@@ -52,7 +52,7 @@ func NewLogger(level, output string) Logger {
|
||||
return Logger{Logger: log.Hook(goroutineHook{}).With().Caller().Timestamp().Logger()}
|
||||
}
|
||||
|
||||
func NewAuditLogger(level, audit string) *Logger {
|
||||
func NewAuditLogger(level, output string) *Logger {
|
||||
loggerSetTimeFormat.Do(func() {
|
||||
zerolog.TimeFieldFormat = time.RFC3339Nano
|
||||
})
|
||||
@@ -66,12 +66,16 @@ func NewAuditLogger(level, audit string) *Logger {
|
||||
|
||||
var auditLog zerolog.Logger
|
||||
|
||||
auditFile, err := os.OpenFile(audit, os.O_APPEND|os.O_WRONLY|os.O_CREATE, defaultPerms)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if output == "" {
|
||||
auditLog = zerolog.New(os.Stdout)
|
||||
} else {
|
||||
auditFile, err := os.OpenFile(output, os.O_APPEND|os.O_WRONLY|os.O_CREATE, defaultPerms)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
auditLog = zerolog.New(auditFile)
|
||||
auditLog = zerolog.New(auditFile)
|
||||
}
|
||||
|
||||
return &Logger{Logger: auditLog.With().Timestamp().Logger()}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user