Update mattermost library

This commit is contained in:
Wim
2024-05-24 01:56:43 +02:00
parent 65d78e38af
commit ee55865a81
1002 changed files with 89450 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