Documentation ¶
Index ¶
Constants ¶
const ( UnknownEnv = Env(0) DevEnv = Env(iota) GCPEnv DefaultEnv = DevEnv )
Variables ¶
var ErrorUnkownEnv = errors.New("unknown logging environment")
Functions ¶
func NewLogger ¶
NewLogger returns a new instance of the zap.Logger based on the specified env and level.
The level sets the minimum level log messages will be output, with env being used to configure the logger for a particular environment.
func NewLoggerFromConfigMap ¶
func NewLoggerFromConfigMap(defaultEnv Env, defaultLevel zapcore.Level, config map[string]string) (*zap.Logger, error)
NewLoggerFromConfigMap returns a new instance of the zap.Logger based on the value of the keys "log-env" and "log-level" in the config map.
If the "log-env" key is not present, defaultEnv will be used. If the "log-level" key is not present, defaultLevel will be used.
Types ¶
type Env ¶
type Env int
func LookupEnv ¶
LookupEnv will return the instance of Env that corresponds to text.
If text does not match a known environment UnknownEnv will be returned.
func (Env) MarshalText ¶
func (*Env) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.