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

Update dependencies (#2180)

* Update dependencies

* Fix whatsmeow API changes
This commit is contained in:
Wim
2024-08-27 19:04:05 +02:00
committed by GitHub
parent d16645c952
commit c4157a4d5b
589 changed files with 681707 additions and 198856 deletions

View File

@ -80,12 +80,13 @@ var _ Logger = &intLogger{}
// intLogger is an internal logger implementation. Internal in that it is
// defined entirely by this package.
type intLogger struct {
json bool
callerOffset int
name string
timeFormat string
timeFn TimeFunction
disableTime bool
json bool
jsonEscapeEnabled bool
callerOffset int
name string
timeFormat string
timeFn TimeFunction
disableTime bool
// This is an interface so that it's shared by any derived loggers, since
// those derived loggers share the bufio.Writer as well.
@ -173,6 +174,7 @@ func newLogger(opts *LoggerOptions) *intLogger {
l := &intLogger{
json: opts.JSONFormat,
jsonEscapeEnabled: !opts.JSONEscapeDisabled,
name: opts.Name,
timeFormat: TimeFormat,
timeFn: time.Now,
@ -667,13 +669,17 @@ func (l *intLogger) logJSON(t time.Time, name string, level Level, msg string, a
}
}
err := json.NewEncoder(l.writer).Encode(vals)
encoder := json.NewEncoder(l.writer)
encoder.SetEscapeHTML(l.jsonEscapeEnabled)
err := encoder.Encode(vals)
if err != nil {
if _, ok := err.(*json.UnsupportedTypeError); ok {
plainVal := l.jsonMapEntry(t, name, level, msg)
plainVal["@warn"] = errJsonUnsupportedTypeMsg
json.NewEncoder(l.writer).Encode(plainVal)
errEncoder := json.NewEncoder(l.writer)
errEncoder.SetEscapeHTML(l.jsonEscapeEnabled)
errEncoder.Encode(plainVal)
}
}
}

View File

@ -264,6 +264,9 @@ type LoggerOptions struct {
// Control if the output should be in JSON.
JSONFormat bool
// Control the escape switch of json.Encoder
JSONEscapeDisabled bool
// Include file and line information in each log line
IncludeLocation bool