Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultLogger ¶
func DefaultLogger() *zap.SugaredLogger
DefaultLogger returns a logger from configuration based on environment variables. If not created default logger, it will creates a new logger and set it to default logger.
func FromContext ¶
func FromContext(ctx context.Context) *zap.SugaredLogger
FromContext returns a logger from given context. If not contained logger from given context, it will return a default logger.
func NewLogger ¶
func NewLogger(develop bool, level string) *zap.SugaredLogger
NewLogger creates a logger with given configuration. If not parse level argument, it will return a logger with info level.
func NewLoggerFromEnv ¶
func NewLoggerFromEnv() *zap.SugaredLogger
NewLoggerFromEnv creates a logger with configuration from environment variables. If not set environment variables, it will return a logger with production mode and info level.
func WithLogger ¶
WithLogger stores a given logger to given context. If context is nil, it will panic. because, this function is wrapper for context.WithValue.
Types ¶
This section is empty.