15357fd3c0
yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarba
35 lines
935 B
Go
35 lines
935 B
Go
// pkg/logger/helpers.go
|
|
package logger
|
|
|
|
import (
|
|
"time"
|
|
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
// LogApplicationStart логирует запуск приложения
|
|
func LogApplicationStart(version, environment, port string) {
|
|
Get().Info("application starting",
|
|
zap.String("version", version),
|
|
zap.String("environment", environment),
|
|
zap.String("port", port),
|
|
zap.Time("start_time", time.Now()),
|
|
)
|
|
}
|
|
|
|
// LogApplicationShutdown логирует graceful shutdown
|
|
func LogApplicationShutdown(reason string) {
|
|
Get().Info("application shutting down",
|
|
zap.String("reason", reason),
|
|
zap.Time("shutdown_time", time.Now()),
|
|
)
|
|
}
|
|
|
|
// LogDatabaseStats логирует статистику базы данных
|
|
func LogDatabaseStats(stats map[string]interface{}) {
|
|
fields := make([]zap.Field, 0, len(stats))
|
|
for key, value := range stats {
|
|
fields = append(fields, zap.Any(key, value))
|
|
}
|
|
Get().Info("database statistics", fields...)
|
|
} |