Documentation
¶
Index ¶
- func Msgf(msg string, args ...any) string
- type Logger
- type ZeroLogger
- func (zl *ZeroLogger) Debug(msg string, fields ...any)
- func (zl *ZeroLogger) Error(msg string, fields ...any)
- func (zl *ZeroLogger) Fatal(msg string, fields ...any)
- func (zl *ZeroLogger) Info(msg string, fields ...any)
- func (zl *ZeroLogger) Panic(msg string, fields ...any)
- func (zl *ZeroLogger) Trace(msg string, fields ...any)
- func (zl *ZeroLogger) Warn(msg string, fields ...any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Logger ¶
type Logger interface {
/*
Fields is a helper function to use a map or slice to set fields using type assertion.
[]any must alternate string keys and arbitrary values, and extraneous ones are ignored. i.e:
With Request HTTP Context:
first := "first value"
second := "second value"
xlogger.FromReqCtx(ctx).Trace("hello", "first", first, "second", second)
xlogger.FromReqCtx(ctx).Trace(xlogger.Msgf("hello %s", "world!"), "first", first, "second", second)
xlogger.FromReqCtx(ctx).Trace("oh snap! got error", "error", fmt.Sprint("%+v", err))
*/
Trace(msg string, fields ...any)
/*
Fields is a helper function to use a map or slice to set fields using type assertion.
[]any must alternate string keys and arbitrary values, and extraneous ones are ignored. i.e:
With Request HTTP Context:
first := "first value"
second := "second value"
xlogger.FromReqCtx(ctx).Debug("hello", "first", first, "second", second)
xlogger.FromReqCtx(ctx).Debug(xlogger.Msgf("hello %s", "world!"), "first", first, "second", second)
xlogger.FromReqCtx(ctx).Debug("oh snap! got error", "error", fmt.Sprint("%+v", err))
*/
Debug(msg string, fields ...any)
/*
Fields is a helper function to use a map or slice to set fields using type assertion.
[]any must alternate string keys and arbitrary values, and extraneous ones are ignored. i.e:
With Request HTTP Context:
first := "first value"
second := "second value"
xlogger.FromReqCtx(ctx).Info("hello", "first", first, "second", second)
xlogger.FromReqCtx(ctx).Info(xlogger.Msgf("hello %s", "world!"), "first", first, "second", second)
xlogger.FromReqCtx(ctx).Info("oh snap! got error", "error", fmt.Sprint("%+v", err))
*/
Info(msg string, fields ...any)
/*
Fields is a helper function to use a map or slice to set fields using type assertion.
[]any must alternate string keys and arbitrary values, and extraneous ones are ignored. i.e:
With Request HTTP Context:
first := "first value"
second := "second value"
xlogger.FromReqCtx(ctx).Warn("hello", "first", first, "second", second)
xlogger.FromReqCtx(ctx).Warn(xlogger.Msgf("hello %s", "world!"), "first", first, "second", second)
xlogger.FromReqCtx(ctx).Warn("oh snap! got error", "error", fmt.Sprint("%+v", err))
*/
Warn(msg string, fields ...any)
/*
Fields is a helper function to use a map or slice to set fields using type assertion.
[]any must alternate string keys and arbitrary values, and extraneous ones are ignored. i.e:
With Request HTTP Context:
first := "first value"
second := "second value"
xlogger.FromReqCtx(ctx).Error("hello", "first", first, "second", second)
xlogger.FromReqCtx(ctx).Error(xlogger.Msgf("hello %s", "world!"), "first", first, "second", second)
xlogger.FromReqCtx(ctx).Error("oh snap! got error", "error", fmt.Sprint("%+v", err))
*/
Error(msg string, fields ...any)
/*
Fields is a helper function to use a map or slice to set fields using type assertion.
[]any must alternate string keys and arbitrary values, and extraneous ones are ignored. i.e:
With Request HTTP Context:
first := "first value"
second := "second value"
xlogger.FromReqCtx(ctx).Fatal("hello", "first", first, "second", second)
xlogger.FromReqCtx(ctx).Fatal(xlogger.Msgf("hello %s", "world!"), "first", first, "second", second)
xlogger.FromReqCtx(ctx).Fatal("oh snap! got error", "error", fmt.Sprint("%+v", err))
*/
Fatal(msg string, fields ...any)
/*
Fields is a helper function to use a map or slice to set fields using type assertion.
[]any must alternate string keys and arbitrary values, and extraneous ones are ignored. i.e:
With Request HTTP Context:
first := "first value"
second := "second value"
xlogger.FromReqCtx(ctx).Panic("hello", "first", first, "second", second)
xlogger.FromReqCtx(ctx).Panic(xlogger.Msgf("hello %s", "world!"), "first", first, "second", second)
xlogger.FromReqCtx(ctx).Panic("oh snap! got error", "error", fmt.Sprint("%+v", err))
*/
Panic(msg string, fields ...any)
}
func FromReqCtx ¶
func NewZeroLogger ¶
type ZeroLogger ¶
type ZeroLogger struct {
// contains filtered or unexported fields
}
func (*ZeroLogger) Debug ¶
func (zl *ZeroLogger) Debug(msg string, fields ...any)
func (*ZeroLogger) Error ¶
func (zl *ZeroLogger) Error(msg string, fields ...any)
func (*ZeroLogger) Fatal ¶
func (zl *ZeroLogger) Fatal(msg string, fields ...any)
func (*ZeroLogger) Info ¶
func (zl *ZeroLogger) Info(msg string, fields ...any)
func (*ZeroLogger) Panic ¶
func (zl *ZeroLogger) Panic(msg string, fields ...any)
func (*ZeroLogger) Trace ¶
func (zl *ZeroLogger) Trace(msg string, fields ...any)
func (*ZeroLogger) Warn ¶
func (zl *ZeroLogger) Warn(msg string, fields ...any)
Click to show internal directories.
Click to hide internal directories.