Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( String = func(key, value string) Field { return Field{Key: key, Value: value} } Int = func(key string, value int) Field { return Field{Key: key, Value: value} } Int64 = func(key string, value int64) Field { return Field{Key: key, Value: value} } Float64 = func(key string, value float64) Field { return Field{Key: key, Value: value} } Bool = func(key string, value bool) Field { return Field{Key: key, Value: value} } Error = func(err error) Field { return Field{Key: "error", Value: err} } Any = func(key string, value interface{}) Field { return Field{Key: key, Value: value} } )
Поля для конвертации
Functions ¶
func SetExitFunc ¶
func SetExitFunc(f func(int))
Types ¶
type Config ¶
type Config struct {
Level string `yaml:"level"`
FilePath string `yaml:"file_path"`
MaxSizeMB int `yaml:"max_size"`
MaxBackups int `yaml:"max_backups"`
MaxAgeDays int `yaml:"max_age"`
Compress bool `yaml:"compress"`
}
Config содержит конфигурацию логгера
type LevelConfig ¶
type LevelConfig struct {
Debug Config `yaml:"debug"`
Info Config `yaml:"info"`
Warn Config `yaml:"warn"`
Error Config `yaml:"error"`
}
LevelConfig содержит конфигурацию для разных уровней логирования
func LoadConfig ¶
func LoadConfig(configPath string) (*LevelConfig, error)
LoadConfig загружает конфигурацию из YAML файла
func LoadDefaultConfig ¶
func LoadDefaultConfig() (*LevelConfig, error)
type LevelLogger ¶
type LevelLogger struct {
// contains filtered or unexported fields
}
LevelLogger представляет собой логгер с разными уровнями
func NewLevel ¶
func NewLevel(configPath string) (*LevelLogger, error)
NewLevel создает новый LevelLogger
func (*LevelLogger) Close ¶
func (m *LevelLogger) Close() error
func (*LevelLogger) Debug ¶
func (m *LevelLogger) Debug(msg string, fields ...Field)
Методы LevelLogger
func (*LevelLogger) Error ¶
func (m *LevelLogger) Error(msg string, fields ...Field)
func (*LevelLogger) Info ¶
func (m *LevelLogger) Info(msg string, fields ...Field)
func (*LevelLogger) Sync ¶
func (m *LevelLogger) Sync() error
func (*LevelLogger) Warn ¶
func (m *LevelLogger) Warn(msg string, fields ...Field)
Click to show internal directories.
Click to hide internal directories.