mirror of
https://github.com/project-zot/zot.git
synced 2026-06-17 04:48:26 +08:00
storage: flush/sync contents to disk on file close
Behavior controlled by configuration (default=off) It is a trade-off between performance and consistency. References: [1] https://github.com/golang/go/issues/20599 Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
This commit is contained in:
committed by
Ramkumar Chinchani
parent
c73e71b018
commit
d2aa016cdb
+3
-3
@@ -68,8 +68,8 @@ func NewAuditLogger(level string, audit string) *Logger {
|
||||
return &Logger{Logger: auditLog.With().Timestamp().Logger()}
|
||||
}
|
||||
|
||||
// goroutineID adds goroutine-id to logs to help debug concurrency issues.
|
||||
func goroutineID() int {
|
||||
// GoroutineID adds goroutine-id to logs to help debug concurrency issues.
|
||||
func GoroutineID() int {
|
||||
var buf [64]byte
|
||||
n := runtime.Stack(buf[:], false)
|
||||
idField := strings.Fields(strings.TrimPrefix(string(buf[:n]), "goroutine "))[0]
|
||||
@@ -86,6 +86,6 @@ type goroutineHook struct{}
|
||||
|
||||
func (h goroutineHook) Run(e *zerolog.Event, level zerolog.Level, msg string) {
|
||||
if level != zerolog.NoLevel {
|
||||
e.Int("goroutine", goroutineID())
|
||||
e.Int("goroutine", GoroutineID())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user