log

package
v0.0.0-...-5cbc45b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 10 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultLevel  = zap.DebugLevel
	DefaultOutput = os.Stdout
)
View Source
var GCP = false
View Source
var GCPEnv = []string{
	"CLOUD_RUN_JOB",
	"K_SERVICE",
	"GOOGLE_CLOUD_PROJECT",
	"GCP",
}

Functions

func AttachLoggerToContext

func AttachLoggerToContext(ctx context.Context, logger *Logger) context.Context

func Debug

func Debug(args ...any)

func Debugc

func Debugc(ctx context.Context, args ...any)

func Debugf

func Debugf(format string, args ...any)

func Debugfc

func Debugfc(ctx context.Context, format string, args ...any)

func Error

func Error(args ...any)

func Errorc

func Errorc(ctx context.Context, args ...any)

func Errorf

func Errorf(format string, args ...any)

func Errorfc

func Errorfc(ctx context.Context, format string, args ...any)

func Fatal

func Fatal(args ...any)

func Fatalc

func Fatalc(ctx context.Context, args ...any)

func Fatalf

func Fatalf(format string, args ...any)

func Fatalfc

func Fatalfc(ctx context.Context, format string, args ...any)

func Info

func Info(args ...any)

func Infoc

func Infoc(ctx context.Context, args ...any)

func Infof

func Infof(format string, args ...any)

func Infofc

func Infofc(ctx context.Context, format string, args ...any)

func Panic

func Panic(args ...any)

func Panicc

func Panicc(ctx context.Context, args ...any)

func Panicf

func Panicf(format string, args ...any)

func Panicfc

func Panicfc(ctx context.Context, format string, args ...any)

func Print

func Print(args ...any)

func Printc

func Printc(ctx context.Context, args ...any)

func Printf

func Printf(format string, args ...any)

func Printfc

func Printfc(ctx context.Context, format string, args ...any)

func SetLevel

func SetLevel(l zapcore.Level)

func SetOutput

func SetOutput(w io.Writer)

func Trace

func Trace(args ...any)

func Tracec

func Tracec(ctx context.Context, args ...any)

func Tracef

func Tracef(format string, args ...any)

func Tracefc

func Tracefc(ctx context.Context, format string, args ...any)

func Warn

func Warn(args ...any)

func Warnc

func Warnc(ctx context.Context, args ...any)

func Warnf

func Warnf(format string, args ...any)

func Warnfc

func Warnfc(ctx context.Context, format string, args ...any)

Types

type Echo

type Echo struct {
	// contains filtered or unexported fields
}

func NewEcho

func NewEcho() *Echo

func NewEchoWith

func NewEchoWith(logger *Logger) *Echo

func (*Echo) AccessLogger

func (l *Echo) AccessLogger() echo.MiddlewareFunc

AccessLogger is a function to get a middleware to log accesses

func (*Echo) Debug

func (l *Echo) Debug(i ...interface{})

Debug string log

func (*Echo) Debugf

func (l *Echo) Debugf(format string, args ...interface{})

Debugf debug JSON log

func (*Echo) Debugj

func (l *Echo) Debugj(j log.JSON)

Debugj debug JSON log

func (*Echo) Error

func (l *Echo) Error(i ...interface{})

Error string log

func (*Echo) Errorf

func (l *Echo) Errorf(format string, args ...interface{})

Errorf error JSON log

func (*Echo) Errorj

func (l *Echo) Errorj(j log.JSON)

Errorj error JSON log

func (*Echo) Fatal

func (l *Echo) Fatal(i ...interface{})

Fatal string log

func (*Echo) Fatalf

func (l *Echo) Fatalf(format string, args ...interface{})

Fatalf fatal JSON log

func (*Echo) Fatalj

func (l *Echo) Fatalj(j log.JSON)

Fatalj fatal JSON log

func (*Echo) Info

func (l *Echo) Info(i ...interface{})

Info string log

func (*Echo) Infof

func (l *Echo) Infof(format string, args ...interface{})

Infof info JSON log

func (*Echo) Infoj

func (l *Echo) Infoj(j log.JSON)

Infoj info JSON log

func (*Echo) Level

func (l *Echo) Level() log.Lvl

Level returns logger level

func (*Echo) Output

func (l *Echo) Output() io.Writer

Output logger output func

func (*Echo) Panic

func (l *Echo) Panic(i ...interface{})

Panic string log

func (*Echo) Panicf

func (l *Echo) Panicf(format string, args ...interface{})

Panicf panic JSON log

func (*Echo) Panicj

func (l *Echo) Panicj(j log.JSON)

Panicj panic JSON log

func (*Echo) Prefix

func (l *Echo) Prefix() string

Prefix It's controlled by Logger

func (*Echo) Print

func (l *Echo) Print(i ...interface{})

Print string log

func (*Echo) Printf

func (l *Echo) Printf(format string, args ...interface{})

Printf print JSON log

func (*Echo) Printj

func (l *Echo) Printj(j log.JSON)

Printj print JSON log

func (*Echo) SetDynamicPrefix

func (l *Echo) SetDynamicPrefix(prefix func() Format)

func (*Echo) SetDynamicSuffix

func (l *Echo) SetDynamicSuffix(suffix func() Format)

func (*Echo) SetHeader

func (l *Echo) SetHeader(_ string)

SetHeader is a stub to satisfy interface It's controlled by Logger

func (*Echo) SetLevel

func (l *Echo) SetLevel(lvl log.Lvl)

SetLevel set level to logger from given log.Lvl

func (*Echo) SetOutput

func (l *Echo) SetOutput(w io.Writer)

SetOutput change output, default os.Stdout

func (*Echo) SetPrefix

func (l *Echo) SetPrefix(s string)

SetPrefix It's controlled by Logger

func (*Echo) Warn

func (l *Echo) Warn(i ...interface{})

Warn string log

func (*Echo) Warnf

func (l *Echo) Warnf(format string, args ...interface{})

Warnf warning JSON log

func (*Echo) Warnj

func (l *Echo) Warnj(j log.JSON)

Warnj warning JSON log

type Format

type Format struct {
	Format string
	Args   []any
}

func (Format) Append

func (f Format) Append(g Format) Format

func (Format) IsEmpty

func (f Format) IsEmpty() bool

func (Format) Prepend

func (f Format) Prepend(g Format) Format

func (Format) String

func (f Format) String() string

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

func GetLoggerFromContext

func GetLoggerFromContext(ctx context.Context) *Logger

func GetLoggerFromContextOrDefault

func GetLoggerFromContextOrDefault(ctx context.Context) *Logger

func New

func New() *Logger

func NewWithOutput

func NewWithOutput(w io.Writer) *Logger

func (*Logger) ClearPrefix

func (l *Logger) ClearPrefix() *Logger

func (*Logger) Debug

func (l *Logger) Debug(args ...any)

func (*Logger) Debugf

func (l *Logger) Debugf(format string, args ...any)

func (*Logger) Debugw

func (l *Logger) Debugw(msg string, keyAndValues ...any)

func (*Logger) Error

func (l *Logger) Error(args ...any)

func (*Logger) Errorf

func (l *Logger) Errorf(format string, args ...any)

func (*Logger) Errorw

func (l *Logger) Errorw(msg string, keyAndValues ...any)

func (*Logger) Fatal

func (l *Logger) Fatal(args ...any)

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, args ...any)

func (*Logger) Fatalw

func (l *Logger) Fatalw(msg string, keyAndValues ...any)

func (*Logger) Info

func (l *Logger) Info(args ...any)

func (*Logger) Infof

func (l *Logger) Infof(format string, args ...any)

func (*Logger) Infow

func (l *Logger) Infow(msg string, keyAndValues ...any)

func (*Logger) Level

func (l *Logger) Level() zapcore.Level

func (*Logger) Panic

func (l *Logger) Panic(args ...any)

func (*Logger) Panicf

func (l *Logger) Panicf(format string, args ...any)

func (*Logger) Panicw

func (l *Logger) Panicw(msg string, keyAndValues ...any)

func (*Logger) Prefix

func (l *Logger) Prefix() string

func (*Logger) Print

func (l *Logger) Print(args ...any)

func (*Logger) Printf

func (l *Logger) Printf(format string, args ...any)

func (*Logger) Printw

func (l *Logger) Printw(msg string, keyAndValues ...any)

func (*Logger) SetDynamicPrefix

func (l *Logger) SetDynamicPrefix(prefix func() Format) *Logger

func (*Logger) SetDynamicSuffix

func (l *Logger) SetDynamicSuffix(suffix func() Format) *Logger

func (*Logger) SetLevel

func (l *Logger) SetLevel(lv zapcore.Level)

func (*Logger) SetOutput

func (l *Logger) SetOutput(w io.Writer) *Logger

func (*Logger) SetPrefix

func (l *Logger) SetPrefix(prefix string) *Logger

func (*Logger) Warn

func (l *Logger) Warn(args ...any)

func (*Logger) Warnf

func (l *Logger) Warnf(format string, args ...any)

func (*Logger) Warnw

func (l *Logger) Warnw(msg string, keyAndValues ...any)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL