Documentation ¶
Index ¶
- func Critical(format string, args ...interface{})
- func Debug(format string, args ...interface{})
- func Error(format string, args ...interface{})
- func Info(format string, args ...interface{})
- func PrepareFile(filename string, owner *user.User) error
- func SetConfig(config *Config) error
- func SetFile(filename string) error
- func SetLevel(lvl string) error
- func Test(callable func(*bytes.Buffer))
- func TestWithLevel(level string, callable func(*bytes.Buffer))
- func UnsetTesting(l *TestingLogger)
- func Warning(format string, args ...interface{})
- type Config
- type FileLogger
- type LogInterface
- type TestingLogger
- type TextFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Critical ¶
func Critical(format string, args ...interface{})
Critical logs a message using CRITICAL as log level.
func Debug ¶
func Debug(format string, args ...interface{})
Debug logs a message using DEBUG as log level.
func Error ¶
func Error(format string, args ...interface{})
Error logs a message using ERROR as log level.
func Info ¶
func Info(format string, args ...interface{})
Info logs a message using INFO as log level.
func PrepareFile ¶
PrepareFile creates logfile and set it writable for user
func Test ¶
Test вызывает функцию, передавая ей буфер-лог в качестве аргумента. Пример использования:
logging.Test(func(log *bytes.Buffer) { logrus.Into("hello world") assert.Contains(log.String(), "hello world") })
func TestWithLevel ¶
TestWithLevel тоже самое что Test, но можно передать кастомный уровень логирования.
func UnsetTesting ¶
func UnsetTesting(l *TestingLogger)
Types ¶
type Config ¶
type Config struct { Logfile string `yaml:"logfile"` Level string `yaml:"level"` // default:"debug" }
Config настройки логирования
type FileLogger ¶
FileLogger обертка
func (*FileLogger) Filename ¶
func (l *FileLogger) Filename() string
Filename возвращает текущее имя файла
func (*FileLogger) Open ¶
func (l *FileLogger) Open(filename string) error
Open устанавливает имя файла для логирования и открывает его
type LogInterface ¶
type LogInterface interface {
Log(args ...interface{})
}
type TestingLogger ¶
type TestingLogger struct {
// contains filtered or unexported fields
}
func SetTesting ¶
func SetTesting(t LogInterface) *TestingLogger
type TextFormatter ¶
type TextFormatter struct { }
TextFormatter копипаста logrus.TextFormatter с косметическими изменениями
Click to show internal directories.
Click to hide internal directories.