slog

package
v0.0.0-...-da19eeb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	// contains filtered or unexported fields
}

Component represents single component logging interface

func (*Component) L

func (c *Component) L() *zap.Logger

L returns strict typed logger which is very fast

func (*Component) S

func (c *Component) S() *zap.SugaredLogger

S returns sugared logger which provides less verbose API

type ComponentConfig

type ComponentConfig struct {
	Preset          string `json:"preset"`
	Level           string `json:"level"`
	JSON            bool   `json:"json"`
	TimestampFormat string `json:"timestamp_format"`
}

ComponentConfig specifies separate logger configuration

type Config

type Config struct {
	ComponentConfigs map[string]*ComponentConfig `json:"components"`
}

Config provides structured logger configuration

type SLog

type SLog struct {
	// contains filtered or unexported fields
}

SLog represents structured logging interface

func NewSLog

func NewSLog(cfg *Config) *SLog

NewSLog produces new instance of SLog based on specified configuration

func (*SLog) C

func (s *SLog) C(component string) *Component

C returns logger for specified component

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL