Documentation ¶
Index ¶
- func FromContext(ctx context.Context) *zap.SugaredLogger
- func Handler(logger *zap.Logger, projectID string) func(next http.Handler) http.Handler
- func Middleware(log *zap.Logger, projectID string) func(next http.Handler) http.Handler
- func Must(log *zap.SugaredLogger, err error) *zap.SugaredLogger
- func NewContext(ctx context.Context, logger *zap.SugaredLogger, fields ...interface{}) context.Context
- func NewLogger(serviceName string) (*zap.SugaredLogger, error)
- func ParseTraceHeader(header string) (string, string, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
func FromContext(ctx context.Context) *zap.SugaredLogger
FromContext returns a logger stored in a context.
func Middleware ¶
Middleware is a middleware for writing request logs in a structured format to stackdriver. It uses a chi Chain to make sure all of the deps are properly included (RequestID and Recoverer).
func Must ¶
func Must(log *zap.SugaredLogger, err error) *zap.SugaredLogger
Must panics if the logger can not be created.
func NewContext ¶
func NewContext(ctx context.Context, logger *zap.SugaredLogger, fields ...interface{}) context.Context
NewContext wraps a context with a logger with default fields.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.