core/logging: change log.Error function (#5251)

* core/logging: change log.Error function

* use request id
This commit is contained in:
Caleb Doxsey 2024-09-05 15:42:46 -06:00 committed by GitHub
parent 97bf5edc54
commit dad954ae16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 163 additions and 166 deletions

View file

@ -88,7 +88,7 @@ func ExampleInfo() {
// Example of a log at a particular "level" (in this case, "error")
func ExampleError() {
captureOutput(func() {
log.Error(context.Background()).Msg("hello world")
log.Error().Msg("hello world")
})
// Output: {"level":"error","time":"2008-01-08T17:05:05Z","message":"hello world"}
}
@ -146,7 +146,7 @@ func ExampleSetLevel() {
log.Debug(context.Background()).Msg("Debug")
log.Info(context.Background()).Msg("Debug or Info")
log.Warn(context.Background()).Msg("Debug or Info or Warn")
log.Error(context.Background()).Msg("Debug or Info or Warn or Error")
log.Error().Msg("Debug or Info or Warn or Error")
log.SetLevel(zerolog.DebugLevel)
log.Debug(context.Background()).Msg("Debug")
})
@ -167,9 +167,9 @@ func ExampleContext() {
return c.Str("param_two", "two")
})
log.Error(bg).Str("non_context_param", "value").Msg("background")
log.Error(ctx1).Str("non_context_param", "value").Msg("first")
log.Error(ctx2).Str("non_context_param", "value").Msg("second")
log.Ctx(bg).Error().Str("non_context_param", "value").Msg("background")
log.Ctx(ctx1).Error().Str("non_context_param", "value").Msg("first")
log.Ctx(ctx2).Error().Str("non_context_param", "value").Msg("second")
for i := 0; i < 10; i++ {
ctx1 = log.WithContext(ctx1, func(c zerolog.Context) zerolog.Context {