MM-34787: Add colored output for non JSON console logs (#17388)

* MM-34787: Add colored output for non JSON console logs

https://mattermost.atlassian.net/browse/MM-34787

```release-note
A new field EnableColor is added to LogSettings and NotificationLogSettings.
Non-JSON console logs will now be colored if that field is set to true.
```

* Trigger CI
Этот коммит содержится в:
Agniva De Sarker
2021-04-13 23:45:56 +05:30
коммит произвёл GitHub
родитель 6f87eb991f
Коммит fa16ecf98a
4 изменённых файлов: 20 добавлений и 4 удалений

Просмотреть файл

@@ -1201,6 +1201,7 @@ type LogSettings struct {
EnableConsole *bool `access:"environment_logging,write_restrictable,cloud_restrictable"`
ConsoleLevel *string `access:"environment_logging,write_restrictable,cloud_restrictable"`
ConsoleJson *bool `access:"environment_logging,write_restrictable,cloud_restrictable"`
EnableColor *bool `access:"environment_logging,write_restrictable,cloud_restrictable"` // telemetry: none
EnableFile *bool `access:"environment_logging,write_restrictable,cloud_restrictable"`
FileLevel *string `access:"environment_logging,write_restrictable,cloud_restrictable"`
FileJson *bool `access:"environment_logging,write_restrictable,cloud_restrictable"`
@@ -1220,6 +1221,10 @@ func (s *LogSettings) SetDefaults() {
s.ConsoleLevel = NewString("DEBUG")
}
if s.EnableColor == nil {
s.EnableColor = NewBool(false)
}
if s.EnableFile == nil {
s.EnableFile = NewBool(true)
}
@@ -1306,6 +1311,7 @@ type NotificationLogSettings struct {
EnableConsole *bool `access:"write_restrictable,cloud_restrictable"`
ConsoleLevel *string `access:"write_restrictable,cloud_restrictable"`
ConsoleJson *bool `access:"write_restrictable,cloud_restrictable"`
EnableColor *bool `access:"write_restrictable,cloud_restrictable"` // telemetry: none
EnableFile *bool `access:"write_restrictable,cloud_restrictable"`
FileLevel *string `access:"write_restrictable,cloud_restrictable"`
FileJson *bool `access:"write_restrictable,cloud_restrictable"`
@@ -1338,6 +1344,10 @@ func (s *NotificationLogSettings) SetDefaults() {
s.ConsoleJson = NewBool(true)
}
if s.EnableColor == nil {
s.EnableColor = NewBool(false)
}
if s.FileJson == nil {
s.FileJson = NewBool(true)
}