package teelogger
import "go.chromium.org/luci/common/logging/teelogger"
Package teelogger implements a logger that splits messages across multiple different loggers.
Index ¶
- func Factory(factories ...logging.Factory) logging.Factory
- func Use(ctx context.Context, factories ...logging.Factory) context.Context
- func UseFiltered(ctx context.Context, filtereds ...Filtered) context.Context
- type Filtered
Functions ¶
func Factory ¶
Factory is a logger factory that produces teeing loggers.
func Use ¶
Use adds a tee logger to the context, using the logger factory in the context, as well as the other loggers produced by given factories.
We use factories (instead of logging.Logger instances), since we must be able to produce logging.Logger instances bound to contexts to be able to use logging levels are fields (they are part of the context state).
func UseFiltered ¶
UseFiltered adds a tee logger to the context, using the logger factory in the context, as well as the other provided by given filtereds. Filtered loggers ignore the current logging level in the context.
We use factories (instead of logging.Logger instances), since we must be able to produce logging.Logger instances bound to contexts to be able to use logging levels are fields (they are part of the context state). The logger instance bound to context is used with level provided by context.
TODO: Individual leaf loggers still filter messages based on the level in the context, so this can be used only to limit the logging level (not to relax it).
Types ¶
type Filtered ¶
Filtered is a static representation of a single entry to filter messages to loggers by provided level.
Source Files ¶
teelogger.go
- Version
- v0.0.0-20250617213133-aba7a89636f9 (latest)
- Published
- Jun 17, 2025
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 4 hours ago –
Tools for package owners.