Tracking Push Notifications in a structured logger (notifications.log) (#10823)
* Remove NotificationRegistry table and use structured logging * Fix ackId for notification sent * Notification logger at server level * Remove unused i18n strings
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
30061df036
Коммит
5b252e8736
@@ -108,7 +108,8 @@ type Server struct {
|
||||
|
||||
ImageProxy *imageproxy.ImageProxy
|
||||
|
||||
Log *mlog.Logger
|
||||
Log *mlog.Logger
|
||||
NotificationsLog *mlog.Logger
|
||||
|
||||
joinCluster bool
|
||||
startMetrics bool
|
||||
@@ -152,7 +153,13 @@ func NewServer(options ...Option) (*Server, error) {
|
||||
}
|
||||
|
||||
if s.Log == nil {
|
||||
s.Log = mlog.NewLogger(utils.MloggerConfigFromLoggerConfig(&s.Config().LogSettings))
|
||||
s.Log = mlog.NewLogger(utils.MloggerConfigFromLoggerConfig(&s.Config().LogSettings, utils.GetLogFileLocation))
|
||||
}
|
||||
|
||||
if s.NotificationsLog == nil {
|
||||
notificationLogSettings := utils.GetLogSettingsFromNotificationsLogSettings(&s.Config().NotificationLogSettings)
|
||||
s.NotificationsLog = mlog.NewLogger(utils.MloggerConfigFromLoggerConfig(notificationLogSettings, utils.GetNotificationsLogFileLocation)).
|
||||
WithCallerSkip(1).With(mlog.String("logSource", "notifications"))
|
||||
}
|
||||
|
||||
// Redirect default golang logger to this logger
|
||||
@@ -162,7 +169,10 @@ func NewServer(options ...Option) (*Server, error) {
|
||||
mlog.InitGlobalLogger(s.Log)
|
||||
|
||||
s.logListenerId = s.AddConfigListener(func(_, after *model.Config) {
|
||||
s.Log.ChangeLevels(utils.MloggerConfigFromLoggerConfig(&after.LogSettings))
|
||||
s.Log.ChangeLevels(utils.MloggerConfigFromLoggerConfig(&after.LogSettings, utils.GetLogFileLocation))
|
||||
|
||||
notificationLogSettings := utils.GetLogSettingsFromNotificationsLogSettings(&after.NotificationLogSettings)
|
||||
s.NotificationsLog.ChangeLevels(utils.MloggerConfigFromLoggerConfig(notificationLogSettings, utils.GetNotificationsLogFileLocation))
|
||||
})
|
||||
|
||||
s.HTTPService = httpservice.MakeHTTPService(s.FakeApp())
|
||||
|
||||
Ссылка в новой задаче
Block a user