Documentation ¶
Overview ¶
Package log implements a simple logging package
Index ¶
- Constants
- func GetId(ctx context.Context) string
- type F
- type Logger
- func (l Logger) Error(e error, fs ...F)
- func (l Logger) Info(f F)
- func (l Logger) StdLogger() *stdLog.Logger
- func (l Logger) WithCaller() Logger
- func (l Logger) WithCtx(ctx context.Context) Logger
- func (l Logger) WithFields(f F) Logger
- func (l Logger) WithImmediate() Logger
- func (l Logger) Write(p []byte) (n int, err error)
Constants ¶
View Source
const CtxKey = logContextKeyType("Ong-logID")
CtxKey is the name under which this library stores the http cookie, http header and context key for the logID.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func (Logger) StdLogger ¶
StdLogger returns a logger from the Go standard library log package. That logger will use l as its output. usage:
l := log.New(ctx, os.Stdout, 100, true) stdLogger := l.StdLogger() stdLogger.Println("hey")
func (Logger) WithCaller ¶
WithCaller return a new logger, based on l, that will include callers info in its output.
func (Logger) WithFields ¶
WithFields return a new logger, based on l, that will include the given fields in all its output.
func (Logger) WithImmediate ¶
WithImmediate return a new logger, based on l, that will log immediately without buffering.
Click to show internal directories.
Click to hide internal directories.