package bklog

import "github.com/moby/buildkit/util/bklog"

Index

Variables

var (
	G = GetLogger
	L = logrus.NewEntry(logrus.StandardLogger())
)

Functions

func GetLogger

func GetLogger(ctx context.Context) (l *logrus.Entry)

GetLogger retrieves the current logger from the context. If no logger is available, the default logger is returned.

func TraceLevelOnlyStack

func TraceLevelOnlyStack() string

TraceLevelOnlyStack returns a stack trace for the current goroutine only if trace level logs are enabled; otherwise it returns an empty string. This ensure we only pay the cost of generating a stack trace when the log entry will actually be emitted.

func WithLogger

func WithLogger(ctx context.Context, logger *logrus.Entry) context.Context

WithLogger returns a new context with the provided logger. Use in combination with logger.WithField(s) for great effect.

Source Files

log.go

Version
v0.21.1 (latest)
Published
Apr 29, 2025
Platform
js/wasm
Imports
5 packages
Last checked
2 hours ago

Tools for package owners.