4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-07-05 14:04:02 +00:00

Update mattermost library (#2152)

* Update mattermost library

* Fix linting
This commit is contained in:
Wim
2024-05-24 23:08:09 +02:00
committed by GitHub
parent 65d78e38af
commit d16645c952
1003 changed files with 89451 additions and 114025 deletions

View File

@ -79,7 +79,7 @@ type gelfRecord struct {
func (gr gelfRecord) MarshalJSONObject(enc *gojay.Encoder) {
enc.AddStringKey(GelfVersionKey, GelfVersion)
enc.AddStringKey(GelfHostKey, gr.getHostname())
enc.AddStringKey(GelfShortKey, gr.Msg())
enc.AddStringKey(GelfShortKey, gr.safeMsg("-")) // Gelf requires a non-empty `short_message`
if gr.level.Stacktrace {
frames := gr.StackFrames()
@ -131,6 +131,15 @@ func (gr gelfRecord) IsNil() bool {
return gr.LogRec == nil
}
// safeMsg returns the log record Message field or an alternate string when msg is empty.
func (gr gelfRecord) safeMsg(alt string) string {
s := gr.Msg()
if s == "" {
s = alt
}
return s
}
func (g *Gelf) getHostname() string {
if g.Hostname != "" {
return g.Hostname