package log

import "github.com/golang/gddo/log"

Index

Functions

func Crit

func Crit(ctx context.Context, msg string, logCtx ...interface{})

Crit is a convenient alias for FromContext(ctx).Crit

func Debug

func Debug(ctx context.Context, msg string, logCtx ...interface{})

Debug is a convenient alias for FromContext(ctx).Debug

func Error

func Error(ctx context.Context, msg string, logCtx ...interface{})

Error is a convenient alias for FromContext(ctx).Error

func Fatal

func Fatal(ctx context.Context, msg string, logCtx ...interface{})

Fatal is equivalent to Crit() followed by a call to os.Exit(1).

func FromContext

func FromContext(ctx context.Context) log15.Logger

FromContext always returns a logger. If there is no logger in the context, it returns the root logger. It is not recommended for use and may be removed in the future.

func Info

func Info(ctx context.Context, msg string, logCtx ...interface{})

Info is a convenient alias for FromContext(ctx).Info

func NewContext

func NewContext(ctx context.Context, l log15.Logger) context.Context

NewContext creates a new context containing the given logger. It is not recommended for use and may be removed in the future.

func NewHTTPContextHandler

func NewHTTPContextHandler(h http.Handler, l log15.Logger, onAppEngine bool) http.Handler

NewHTTPContextHandler adds a context logger based on the given logger to each request. After a request passes through this handler, Error(req.Context(), "foo") will log to that logger and add useful context to each log entry.

func Warn

func Warn(ctx context.Context, msg string, logCtx ...interface{})

Warn is a convenient alias for FromContext(ctx).Warn

Source Files

http_handler.go log.go

Version
v0.0.0-20210115222349-20d68f94ee1f (latest)
Published
Jan 15, 2021
Platform
linux/amd64
Imports
7 packages
Last checked
6 hours ago

Tools for package owners.