Documentation ¶
Index ¶
- func AnyError(e ...error) error
- func ApplyConfig(conf []Config) error
- func CheckConfig(conf []Config, allowNames []string) error
- func Default() *zap.Logger
- func Logger(logger string) *zap.Logger
- func NewJSONEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
- func NewMixedEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
- func PrepareFileForUser(filename string, owner *user.User) error
- func RegisterScheme(scheme string, constructor func(path string) (Output, error))
- func Test() func()
- func TestCapture() string
- func TestString() string
- type Config
- type DsnObj
- func (dsn *DsnObj) Bool(key string, initial bool) (bool, error)
- func (dsn *DsnObj) Duration(key string, initial string) (time.Duration, error)
- func (dsn *DsnObj) Int(key string, initial int) (int, error)
- func (dsn *DsnObj) SetDuration(p *time.Duration, key string) error
- func (dsn *DsnObj) SetInt(p *int, key string) error
- func (dsn *DsnObj) SetString(p *string, key string) error
- func (dsn *DsnObj) String(key string, initial string) (string, error)
- func (dsn *DsnObj) StringRequired(key string) (string, error)
- type FileOutput
- type Manager
- type Output
- type WriteSyncer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyConfig ¶
func CheckConfig ¶
func NewJSONEncoder ¶
func NewJSONEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
NewJSONEncoder creates a fast, low-allocation JSON encoder. The encoder appropriately escapes all field keys and values.
Note that the encoder doesn't deduplicate keys, so it's possible to produce a message like
{"foo":"bar","foo":"baz"}
This is permitted by the JSON specification, but not encouraged. Many libraries will ignore duplicate key-value pairs (typically keeping the last pair) when unmarshaling, but users should attempt to avoid adding duplicate keys.
func NewMixedEncoder ¶
func NewMixedEncoder(cfg zapcore.EncoderConfig) zapcore.Encoder
func RegisterScheme ¶
func TestCapture ¶
func TestCapture() string
func TestString ¶
func TestString() string
Types ¶
type Config ¶
type Config struct { Logger string `toml:"logger" json:"logger" comment:"handler name, default empty"` File string `toml:"file" json:"file" comment:"'/path/to/filename', 'stderr', 'stdout', 'empty' (=='stderr'), 'none'"` Level string `toml:"level" json:"level" comment:"'debug', 'info', 'warn', 'error', 'dpanic', 'panic', and 'fatal'"` Encoding string `toml:"encoding" json:"encoding" comment:"'json' or 'console'"` EncodingTime string `toml:"encoding-time" json:"encoding-time" comment:"'millis', 'nanos', 'epoch', 'iso8601'"` EncodingDuration string `toml:"encoding-duration" json:"encoding-duration" comment:"'seconds', 'nanos', 'string'"` SampleTick string `toml:"sample-tick" json:"sample-tick" comment:"passed to time.ParseDuration"` SampleInitial int `toml:"sample-initial" json:"sample-initial" comment:"first n messages logged per tick"` SampleThereafter int `toml:"sample-thereafter" json:"sample-thereafter" comment:"every m-th message logged thereafter per tick"` }
Config configures a zapwriter.
If SampleTick is defined, the Sample* parameters are passed to zapcore.NewSampler. See their documentation for details.
type FileOutput ¶
with external rotate support
func File ¶
func File(path string) (*FileOutput, error)
func (*FileOutput) Close ¶
func (r *FileOutput) Close() (err error)
func (*FileOutput) Sync ¶
func (r *FileOutput) Sync() (err error)
type Manager ¶
func NewManager ¶
type WriteSyncer ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.