mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
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
This commit is contained in:
committed by
Christopher Speller
parent
30061df036
commit
5b252e8736
@@ -13,11 +13,14 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
LOG_ROTATE_SIZE = 10000
|
||||
LOG_FILENAME = "mattermost.log"
|
||||
LOG_ROTATE_SIZE = 10000
|
||||
LOG_FILENAME = "mattermost.log"
|
||||
LOG_NOTIFICATION_FILENAME = "notifications.log"
|
||||
)
|
||||
|
||||
func MloggerConfigFromLoggerConfig(s *model.LogSettings) *mlog.LoggerConfiguration {
|
||||
type fileLocationFunc func(string) string
|
||||
|
||||
func MloggerConfigFromLoggerConfig(s *model.LogSettings, getFileFunc fileLocationFunc) *mlog.LoggerConfiguration {
|
||||
return &mlog.LoggerConfiguration{
|
||||
EnableConsole: *s.EnableConsole,
|
||||
ConsoleJson: *s.ConsoleJson,
|
||||
@@ -25,7 +28,7 @@ func MloggerConfigFromLoggerConfig(s *model.LogSettings) *mlog.LoggerConfigurati
|
||||
EnableFile: *s.EnableFile,
|
||||
FileJson: *s.FileJson,
|
||||
FileLevel: strings.ToLower(*s.FileLevel),
|
||||
FileLocation: GetLogFileLocation(*s.FileLocation),
|
||||
FileLocation: getFileFunc(*s.FileLocation),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +40,26 @@ func GetLogFileLocation(fileLocation string) string {
|
||||
return filepath.Join(fileLocation, LOG_FILENAME)
|
||||
}
|
||||
|
||||
func GetNotificationsLogFileLocation(fileLocation string) string {
|
||||
if fileLocation == "" {
|
||||
fileLocation, _ = fileutils.FindDir("logs")
|
||||
}
|
||||
|
||||
return filepath.Join(fileLocation, LOG_NOTIFICATION_FILENAME)
|
||||
}
|
||||
|
||||
func GetLogSettingsFromNotificationsLogSettings(notificationLogSettings *model.NotificationLogSettings) *model.LogSettings {
|
||||
return &model.LogSettings{
|
||||
ConsoleJson: notificationLogSettings.ConsoleJson,
|
||||
ConsoleLevel: notificationLogSettings.ConsoleLevel,
|
||||
EnableConsole: notificationLogSettings.EnableConsole,
|
||||
EnableFile: notificationLogSettings.EnableFile,
|
||||
FileJson: notificationLogSettings.FileJson,
|
||||
FileLevel: notificationLogSettings.FileLevel,
|
||||
FileLocation: notificationLogSettings.FileLocation,
|
||||
}
|
||||
}
|
||||
|
||||
// DON'T USE THIS Modify the level on the app logger
|
||||
func DisableDebugLogForTest() {
|
||||
mlog.GloballyDisableDebugLogForTest()
|
||||
|
||||
Reference in New Issue
Block a user