Documentation
¶
Index ¶
- Variables
- func ConfigureWithContent(str []byte) error
- func ConfigureWithFile(path string) error
- func ConfigureWithString(str string) error
- func DefaultPrefixWidth() int
- func GetLogger(prefix string) *log.Logger
- func GetLoggerOpt(prefix string, opt int) *log.Logger
- func IsTTY(out io.Writer) bool
- func LogAction(prefix string, action string)
- func LogActionf(prefix string, format string, args ...interface{})
- func LogError(prefix string, action string, err error)
- func LogErrorf(prefix string, err error, format string, args ...interface{})
- func LogLevelName(level Level) string
- func LogTarget(prefix string, action string, target interface{})
- func SetDefaultLevel(lvl Level)
- func SetDefaultPrefixWidth(width int)
- func SetDefaultWriter(out io.Writer)
- func SetLevel(name string, lvl Level)
- func StringToLogLevelHookFunc(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error)
- type Config
- type Level
- type LevelConfig
- type Log
- type LogAppender
- type Logging
- func Configure(cfg *Config) Logging
- func New(cfg *Config) Logging
- func NewLoggingWithDiscard(name string) Logging
- func NewLoggingWithWriter(name string, out io.Writer) Logging
- func NewWithFilename(name string, filename string, maxSize int, console bool) Logging
- func SetDefaultLogging(l Logging) Logging
Constants ¶
This section is empty.
Variables ¶
View Source
var Discard = log.New(ioutil.Discard, "", 0)
Discard logger used when no `Logger` and `writer` configures
Functions ¶
func ConfigureWithContent ¶
func ConfigureWithFile ¶
func ConfigureWithString ¶
func DefaultPrefixWidth ¶
func DefaultPrefixWidth() int
func LogActionf ¶
func LogLevelName ¶
func SetDefaultLevel ¶
func SetDefaultLevel(lvl Level)
func SetDefaultPrefixWidth ¶
func SetDefaultPrefixWidth(width int)
func SetDefaultWriter ¶
Types ¶
type Config ¶
type Config struct {
Name string `yaml:"name" json:"name"`
Console bool `yaml:"console" json:"console"`
Filename string `yaml:"filename" json:"filename"`
Append bool `yaml:"append" json:"append"`
RotateSchedule string `yaml:"roateSchedule" json:"rotateSchedule"`
MaxSize int `yaml:"maxSize" json:"maxSize"`
MaxBackups int `yaml:"maxBackups" json:"maxBackups"`
MaxAge int `yaml:"maxAge" json:"maxAge"`
Compress bool `yaml:"compress" json:"compress"`
Levels []LevelConfig `yaml:"levels" json:"levels"`
DefaultPrefixWidth int `yaml:"defaultPrefixWidth" json:"defaultPrefixWidth"`
DefaultLevel Level `yaml:"defaultLevel" json:"defaultLevel"`
}
type Level ¶
type Level int
func DefaultLevel ¶
func DefaultLevel() Level
func ParseLogLevel ¶
func ParseLogLevelP ¶
func (*Level) UnmarshalJSON ¶
type LevelConfig ¶
type Log ¶
type Log interface {
TraceEnabled() bool
Trace(string)
Tracef(fmt string, args ...interface{})
DebugEnabled() bool
Debug(string)
Debugf(fmt string, args ...interface{})
InfoEnabled() bool
Info(string)
Infof(fmt string, args ...interface{})
WarnEnabled() bool
Warn(string)
Warnf(fmt string, args ...interface{})
ErrorEnabled() bool
Error(string)
Errorf(fmt string, args ...interface{})
Log(level Level, m string)
Logf(level Level, fmt string, args ...interface{})
SetLevel(level Level)
Level() Level
}
type LogAppender ¶
type LogAppender struct {
// contains filtered or unexported fields
}
func (*LogAppender) Configure ¶
func (s *LogAppender) Configure(cfg *Config) error
func (*LogAppender) Name ¶
func (s *LogAppender) Name() string
//////////////////////////////////////// BEGIN: implements logging.Logging
func (*LogAppender) Printf ¶
func (s *LogAppender) Printf(format string, v ...interface{})
type Logging ¶
type Logging interface {
Name() string
Printf(format string, v ...interface{})
Write(p []byte) (n int, err error)
}
func NewLoggingWithDiscard ¶
func NewWithFilename ¶
func SetDefaultLogging ¶
Click to show internal directories.
Click to hide internal directories.