mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-16 00:06:31 +02:00
core/logging: change log.Error function (#5251)
* core/logging: change log.Error function * use request id
This commit is contained in:
parent
97bf5edc54
commit
dad954ae16
66 changed files with 163 additions and 166 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue