/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
go/logger/context_with_logging.go
52 строки
1 KB
chrisnojima-zoom
Version 670 - clean2 (#29122)
08 июн 2026, 19:31
Не верифицирован
08 июн 2026, 19:31
1943197
Код
Авторство
О чём код?
package logger import ( "context" ) type Context struct { ctx context.Context Logger } var _ ContextInterface = Context{} func (c Context) Ctx() context.Context { return c.ctx } func NewContext(c context.Context, l Logger) Context { return Context{ctx: c, Logger: l} } func (c Context) UpdateContextToLoggerContext(ctx context.Context) ContextInterface { return NewContext(ctx, c.Logger) } func (c Context) Debug(format string, arg ...any) { c.Logger.CloneWithAddedDepth(1).CDebugf(c.ctx, format, arg...) } func (c Context) Info(format string, arg ...any) { c.Logger.CloneWithAddedDepth(1).CInfof(c.ctx, format, arg...) } func (c Context) Notice(format string, arg ...any) { c.Logger.CloneWithAddedDepth(1).CNoticef(c.ctx, format, arg...) } func (c Context) Warning(format string, arg ...any) { c.Logger.CloneWithAddedDepth(1).CWarningf(c.ctx, format, arg...) } func (c Context) Error(format string, arg ...any) { c.Logger.CloneWithAddedDepth(1).CErrorf(c.ctx, format, arg...) } func (c Context) Critical(format string, arg ...any) { c.Logger.CloneWithAddedDepth(1).CCriticalf(c.ctx, format, arg...) } func (c Context) Fatal(format string, arg ...any) { c.Logger.CloneWithAddedDepth(1).CFatalf(c.ctx, format, arg...) }