Documentation ¶
Index ¶
- func BuildZapConfig(opts ...ZapConfigOption) zap.Config
- func Config(opts ...ZapConfigOption) (*zap.Logger, func(), error)
- func FromContext(ctx context.Context) *zap.Logger
- func FromContextWithoutDefault(ctx context.Context) *zap.Logger
- func NewContext(ctx context.Context, logger *zap.Logger) context.Context
- type ZapConfig
- type ZapConfigOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildZapConfig ¶
func BuildZapConfig(opts ...ZapConfigOption) zap.Config
BuildZapConfig generates the zap Config
func Config ¶
func Config(opts ...ZapConfigOption) (*zap.Logger, func(), error)
Config configures a Zap logger based on the environment string and debugLevel
func FromContext ¶
FromContext returns a logger associated with a context. If the context has no logger, the global logger is returned
func FromContextWithoutDefault ¶
FromContextWithoutDefault returns a logger associated with a context. If the context has no logger, nil is returned
Types ¶
type ZapConfig ¶
ZapConfig defines the configurable parameters you can pass in when setting up the logger. See examples where we call logging.Config
type ZapConfigOption ¶
type ZapConfigOption func(*ZapConfig)
ZapConfigOption is the type for the possible options you can pass in to logging.Config
func WithEnvironment ¶
func WithEnvironment(environment string) ZapConfigOption
WithEnvironment provides an option to pass in the environment
func WithLoggingLevel ¶
func WithLoggingLevel(level string) ZapConfigOption
WithLoggingLevel provides an option to pass in the logging level
func WithStacktraceLength ¶
func WithStacktraceLength(length int) ZapConfigOption
WithStacktraceLength provides an option to pass in the stack trace length