package log
import "github.com/containerd/containerd/log"
Index ¶
- Constants
- Variables
- func GetLevel() log.Level
- func GetLogger(ctx context.Context) *log.Entry
- func SetFormat(format OutputFormat) error
- func SetLevel(level string) error
- func WithLogger(ctx context.Context, logger *log.Entry) context.Context
- type Entry
- type Fields
- type Level
- type OutputFormat
Constants ¶
const ( // TextFormat represents the text logging format. TextFormat log.OutputFormat = "text" // JSONFormat represents the JSON logging format. JSONFormat log.OutputFormat = "json" )
Supported log output formats.
const RFC3339NanoFixed = log.RFC3339NanoFixed
RFC3339NanoFixed is time.RFC3339Nano with nanoseconds padded using zeros to ensure the formatted time is always the same number of characters.
Variables ¶
G is a shorthand for GetLogger.
L is an alias for the standard logger.
Functions ¶
func GetLevel ¶
GetLevel returns the current log level.
func GetLogger ¶
GetLogger retrieves the current logger from the context. If no logger is available, the default logger is returned.
func SetFormat ¶
func SetFormat(format OutputFormat) error
SetFormat sets the log output format.
func SetLevel ¶
SetLevel sets log level globally. It returns an error if the given level is not supported.
func WithLogger ¶
WithLogger returns a new context with the provided logger. Use in combination with logger.WithField(s) for great effect.
Types ¶
type Entry ¶
Entry is a logging entry.
type Fields ¶
Fields type to pass to "WithFields".
type Level ¶
Level is a logging level.
const ( // TraceLevel level. TraceLevel Level = log.TraceLevel // DebugLevel level. DebugLevel Level = log.DebugLevel // InfoLevel level. InfoLevel Level = log.InfoLevel // WarnLevel level. WarnLevel Level = log.WarnLevel // ErrorLevel level ErrorLevel Level = log.ErrorLevel // FatalLevel level. FatalLevel Level = log.FatalLevel // PanicLevel level. PanicLevel Level = log.PanicLevel )
Supported log levels.
type OutputFormat ¶
type OutputFormat = log.OutputFormat
OutputFormat specifies a log output format.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
log/logtest |
- Version
- v1.6.32
- Published
- May 22, 2024
- Platform
- js/wasm
- Imports
- 2 packages
- Last checked
- 6 minutes ago –
Tools for package owners.