Update dependencies

This commit is contained in:
Tulir Asokan 2018-09-20 01:28:37 +03:00
parent 22ef8195dd
commit 2a0106da26
17 changed files with 1229 additions and 347 deletions

View file

@ -1,20 +1,19 @@
// mauLogger - A logger for Go programs
// Copyright (C) 2016 Tulir Asokan
// Copyright (C) 2016-2018 Tulir Asokan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// Package maulogger ...
package maulogger
import (
@ -22,214 +21,249 @@ import (
)
// DefaultLogger ...
var DefaultLogger = Create()
var DefaultLogger = Create().(*BasicLogger)
// SetWriter formats the given parts with fmt.Sprint and log them with the SetWriter level
// SetWriter formats the given parts with fmt.Sprint and logs the result with the SetWriter level
func SetWriter(w *os.File) {
DefaultLogger.SetWriter(w)
}
// OpenFile formats the given parts with fmt.Sprint and log them with the OpenFile level
// OpenFile formats the given parts with fmt.Sprint and logs the result with the OpenFile level
func OpenFile() error {
return DefaultLogger.OpenFile()
}
// Close formats the given parts with fmt.Sprint and log them with the Close level
// Close formats the given parts with fmt.Sprint and logs the result with the Close level
func Close() {
DefaultLogger.Close()
}
// CreateSublogger creates a Sublogger
func CreateSublogger(module string, DefaultLevel Level) *Sublogger {
return DefaultLogger.CreateSublogger(module, DefaultLevel)
// Sub creates a Sublogger
func Sub(module string) Logger {
return DefaultLogger.Sub(module)
}
// Raw formats the given parts with fmt.Sprint and log them with the Raw level
// Raw formats the given parts with fmt.Sprint and logs the result with the Raw level
func Raw(level Level, module, message string) {
DefaultLogger.Raw(level, module, message)
}
// Log formats the given parts with fmt.Sprint and log them with the Log level
// Log formats the given parts with fmt.Sprint and logs the result with the given level
func Log(level Level, parts ...interface{}) {
DefaultLogger.DefaultSub.Log(level, parts...)
}
// Logln formats the given parts with fmt.Sprintln and log them with the Log level
// Logln formats the given parts with fmt.Sprintln and logs the result with the given level
func Logln(level Level, parts ...interface{}) {
DefaultLogger.DefaultSub.Logln(level, parts...)
}
// Logf formats the given message and args with fmt.Sprintf and log them with the Log level
// Logf formats the given message and args with fmt.Sprintf and logs the result with the given level
func Logf(level Level, message string, args ...interface{}) {
DefaultLogger.DefaultSub.Logf(level, message, args...)
}
// Debug formats the given parts with fmt.Sprint and log them with the Debug level
// Logfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the given level
func Logfln(level Level, message string, args ...interface{}) {
DefaultLogger.DefaultSub.Logfln(level, message, args...)
}
// Debug formats the given parts with fmt.Sprint and logs the result with the Debug level
func Debug(parts ...interface{}) {
DefaultLogger.DefaultSub.Debug(parts...)
}
// Debugln formats the given parts with fmt.Sprintln and log them with the Debug level
// Debugln formats the given parts with fmt.Sprintln and logs the result with the Debug level
func Debugln(parts ...interface{}) {
DefaultLogger.DefaultSub.Debugln(parts...)
}
// Debugf formats the given message and args with fmt.Sprintf and log them with the Debug level
// Debugf formats the given message and args with fmt.Sprintf and logs the result with the Debug level
func Debugf(message string, args ...interface{}) {
DefaultLogger.DefaultSub.Debugf(message, args...)
}
// Info formats the given parts with fmt.Sprint and log them with the Info level
// Info formats the given parts with fmt.Sprint and logs the result with the Info level
func Info(parts ...interface{}) {
DefaultLogger.DefaultSub.Info(parts...)
}
// Infoln formats the given parts with fmt.Sprintln and log them with the Info level
// Infoln formats the given parts with fmt.Sprintln and logs the result with the Info level
func Infoln(parts ...interface{}) {
DefaultLogger.DefaultSub.Infoln(parts...)
}
// Infof formats the given message and args with fmt.Sprintf and log them with the Info level
// Infof formats the given message and args with fmt.Sprintf and logs the result with the Info level
func Infof(message string, args ...interface{}) {
DefaultLogger.DefaultSub.Infof(message, args...)
}
// Warn formats the given parts with fmt.Sprint and log them with the Warn level
// Warn formats the given parts with fmt.Sprint and logs the result with the Warn level
func Warn(parts ...interface{}) {
DefaultLogger.DefaultSub.Warn(parts...)
}
// Warnln formats the given parts with fmt.Sprintln and log them with the Warn level
// Warnln formats the given parts with fmt.Sprintln and logs the result with the Warn level
func Warnln(parts ...interface{}) {
DefaultLogger.DefaultSub.Warnln(parts...)
}
// Warnf formats the given message and args with fmt.Sprintf and log them with the Warn level
// Warnf formats the given message and args with fmt.Sprintf and logs the result with the Warn level
func Warnf(message string, args ...interface{}) {
DefaultLogger.DefaultSub.Warnf(message, args...)
}
// Error formats the given parts with fmt.Sprint and log them with the Error level
// Error formats the given parts with fmt.Sprint and logs the result with the Error level
func Error(parts ...interface{}) {
DefaultLogger.DefaultSub.Error(parts...)
}
// Errorln formats the given parts with fmt.Sprintln and log them with the Error level
// Errorln formats the given parts with fmt.Sprintln and logs the result with the Error level
func Errorln(parts ...interface{}) {
DefaultLogger.DefaultSub.Errorln(parts...)
}
// Errorf formats the given message and args with fmt.Sprintf and log them with the Error level
// Errorf formats the given message and args with fmt.Sprintf and logs the result with the Error level
func Errorf(message string, args ...interface{}) {
DefaultLogger.DefaultSub.Errorf(message, args...)
}
// Fatal formats the given parts with fmt.Sprint and log them with the Fatal level
// Fatal formats the given parts with fmt.Sprint and logs the result with the Fatal level
func Fatal(parts ...interface{}) {
DefaultLogger.DefaultSub.Fatal(parts...)
}
// Fatalln formats the given parts with fmt.Sprintln and log them with the Fatal level
// Fatalln formats the given parts with fmt.Sprintln and logs the result with the Fatal level
func Fatalln(parts ...interface{}) {
DefaultLogger.DefaultSub.Fatalln(parts...)
}
// Fatalf formats the given message and args with fmt.Sprintf and log them with the Fatal level
// Fatalf formats the given message and args with fmt.Sprintf and logs the result with the Fatal level
func Fatalf(message string, args ...interface{}) {
DefaultLogger.DefaultSub.Fatalf(message, args...)
}
// Write formats the given parts with fmt.Sprint and log them with the Write level
func (log *Logger) Write(p []byte) (n int, err error) {
// Write formats the given parts with fmt.Sprint and logs the result with the Write level
func (log *BasicLogger) Write(p []byte) (n int, err error) {
return log.DefaultSub.Write(p)
}
// Log formats the given parts with fmt.Sprint and log them with the Log level
func (log *Logger) Log(level Level, parts ...interface{}) {
// Log formats the given parts with fmt.Sprint and logs the result with the given level
func (log *BasicLogger) Log(level Level, parts ...interface{}) {
log.DefaultSub.Log(level, parts...)
}
// Logln formats the given parts with fmt.Sprintln and log them with the Log level
func (log *Logger) Logln(level Level, parts ...interface{}) {
// Logln formats the given parts with fmt.Sprintln and logs the result with the given level
func (log *BasicLogger) Logln(level Level, parts ...interface{}) {
log.DefaultSub.Logln(level, parts...)
}
// Logf formats the given message and args with fmt.Sprintf and log them with the Log level
func (log *Logger) Logf(level Level, message string, args ...interface{}) {
// Logf formats the given message and args with fmt.Sprintf and logs the result with the given level
func (log *BasicLogger) Logf(level Level, message string, args ...interface{}) {
log.DefaultSub.Logf(level, message, args...)
}
// Debug formats the given parts with fmt.Sprint and log them with the Debug level
func (log *Logger) Debug(parts ...interface{}) {
// Logfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the given level
func (log *BasicLogger) Logfln(level Level, message string, args ...interface{}) {
log.DefaultSub.Logfln(level, message, args...)
}
// Debug formats the given parts with fmt.Sprint and logs the result with the Debug level
func (log *BasicLogger) Debug(parts ...interface{}) {
log.DefaultSub.Debug(parts...)
}
// Debugln formats the given parts with fmt.Sprintln and log them with the Debug level
func (log *Logger) Debugln(parts ...interface{}) {
// Debugln formats the given parts with fmt.Sprintln and logs the result with the Debug level
func (log *BasicLogger) Debugln(parts ...interface{}) {
log.DefaultSub.Debugln(parts...)
}
// Debugf formats the given message and args with fmt.Sprintf and log them with the Debug level
func (log *Logger) Debugf(message string, args ...interface{}) {
// Debugf formats the given message and args with fmt.Sprintf and logs the result with the Debug level
func (log *BasicLogger) Debugf(message string, args ...interface{}) {
log.DefaultSub.Debugf(message, args...)
}
// Info formats the given parts with fmt.Sprint and log them with the Info level
func (log *Logger) Info(parts ...interface{}) {
// Debugfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Debug level
func (log *BasicLogger) Debugfln(message string, args ...interface{}) {
log.DefaultSub.Debugfln(message, args...)
}
// Info formats the given parts with fmt.Sprint and logs the result with the Info level
func (log *BasicLogger) Info(parts ...interface{}) {
log.DefaultSub.Info(parts...)
}
// Infoln formats the given parts with fmt.Sprintln and log them with the Info level
func (log *Logger) Infoln(parts ...interface{}) {
// Infoln formats the given parts with fmt.Sprintln and logs the result with the Info level
func (log *BasicLogger) Infoln(parts ...interface{}) {
log.DefaultSub.Infoln(parts...)
}
// Infof formats the given message and args with fmt.Sprintf and log them with the Info level
func (log *Logger) Infof(message string, args ...interface{}) {
// Infofln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Info level
func (log *BasicLogger) Infofln(message string, args ...interface{}) {
log.DefaultSub.Infofln(message, args...)
}
// Infof formats the given message and args with fmt.Sprintf and logs the result with the Info level
func (log *BasicLogger) Infof(message string, args ...interface{}) {
log.DefaultSub.Infof(message, args...)
}
// Warn formats the given parts with fmt.Sprint and log them with the Warn level
func (log *Logger) Warn(parts ...interface{}) {
// Warn formats the given parts with fmt.Sprint and logs the result with the Warn level
func (log *BasicLogger) Warn(parts ...interface{}) {
log.DefaultSub.Warn(parts...)
}
// Warnln formats the given parts with fmt.Sprintln and log them with the Warn level
func (log *Logger) Warnln(parts ...interface{}) {
// Warnln formats the given parts with fmt.Sprintln and logs the result with the Warn level
func (log *BasicLogger) Warnln(parts ...interface{}) {
log.DefaultSub.Warnln(parts...)
}
// Warnf formats the given message and args with fmt.Sprintf and log them with the Warn level
func (log *Logger) Warnf(message string, args ...interface{}) {
// Warnfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Warn level
func (log *BasicLogger) Warnfln(message string, args ...interface{}) {
log.DefaultSub.Warnfln(message, args...)
}
// Warnf formats the given message and args with fmt.Sprintf and logs the result with the Warn level
func (log *BasicLogger) Warnf(message string, args ...interface{}) {
log.DefaultSub.Warnf(message, args...)
}
// Error formats the given parts with fmt.Sprint and log them with the Error level
func (log *Logger) Error(parts ...interface{}) {
// Error formats the given parts with fmt.Sprint and logs the result with the Error level
func (log *BasicLogger) Error(parts ...interface{}) {
log.DefaultSub.Error(parts...)
}
// Errorln formats the given parts with fmt.Sprintln and log them with the Error level
func (log *Logger) Errorln(parts ...interface{}) {
// Errorln formats the given parts with fmt.Sprintln and logs the result with the Error level
func (log *BasicLogger) Errorln(parts ...interface{}) {
log.DefaultSub.Errorln(parts...)
}
// Errorf formats the given message and args with fmt.Sprintf and log them with the Error level
func (log *Logger) Errorf(message string, args ...interface{}) {
// Errorf formats the given message and args with fmt.Sprintf and logs the result with the Error level
func (log *BasicLogger) Errorf(message string, args ...interface{}) {
log.DefaultSub.Errorf(message, args...)
}
// Fatal formats the given parts with fmt.Sprint and log them with the Fatal level
func (log *Logger) Fatal(parts ...interface{}) {
// Errorfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Error level
func (log *BasicLogger) Errorfln(message string, args ...interface{}) {
log.DefaultSub.Errorfln(message, args...)
}
// Fatal formats the given parts with fmt.Sprint and logs the result with the Fatal level
func (log *BasicLogger) Fatal(parts ...interface{}) {
log.DefaultSub.Fatal(parts...)
}
// Fatalln formats the given parts with fmt.Sprintln and log them with the Fatal level
func (log *Logger) Fatalln(parts ...interface{}) {
// Fatalln formats the given parts with fmt.Sprintln and logs the result with the Fatal level
func (log *BasicLogger) Fatalln(parts ...interface{}) {
log.DefaultSub.Fatalln(parts...)
}
// Fatalf formats the given message and args with fmt.Sprintf and log them with the Fatal level
func (log *Logger) Fatalf(message string, args ...interface{}) {
// Fatalf formats the given message and args with fmt.Sprintf and logs the result with the Fatal level
func (log *BasicLogger) Fatalf(message string, args ...interface{}) {
log.DefaultSub.Fatalf(message, args...)
}
// Fatalfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Fatal level
func (log *BasicLogger) Fatalfln(message string, args ...interface{}) {
log.DefaultSub.Fatalfln(message, args...)
}

View file

@ -1,20 +1,19 @@
// mauLogger - A logger for Go programs
// Copyright (C) 2016 Tulir Asokan
// Copyright (C) 2016-2018 Tulir Asokan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// Package maulogger ...
package maulogger
import (
@ -29,9 +28,9 @@ type Level struct {
var (
// LevelDebug is the level for debug messages.
LevelDebug = Level{Name: "DEBUG", Color: 36, Severity: 0}
LevelDebug = Level{Name: "DEBUG", Color: -1, Severity: 0}
// LevelInfo is the level for basic log messages.
LevelInfo = Level{Name: "INFO", Color: -1, Severity: 10}
LevelInfo = Level{Name: "INFO", Color: 36, Severity: 10}
// LevelWarn is the level saying that something went wrong, but the program will continue operating mostly normally.
LevelWarn = Level{Name: "WARN", Color: 33, Severity: 50}
// LevelError is the level saying that something went wrong and the program may not operate as expected, but will still continue.

View file

@ -1,20 +1,19 @@
// mauLogger - A logger for Go programs
// Copyright (C) 2016 Tulir Asokan
// Copyright (C) 2016-2018 Tulir Asokan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// Package maulogger ...
package maulogger
import (
@ -26,47 +25,57 @@ import (
// LoggerFileFormat ...
type LoggerFileFormat func(now string, i int) string
// Logger ...
type Logger struct {
type BasicLogger struct {
PrintLevel int
FlushLineThreshold int
FileTimeFormat string
FileFormat LoggerFileFormat
TimeFormat string
FileMode os.FileMode
DefaultSub *Sublogger
DefaultSub Logger
writer *os.File
lines int
prefixPrinted bool
}
// GeneralLogger contains advanced logging functions and also implements io.Writer
type GeneralLogger interface {
// Logger contains advanced logging functions and also implements io.Writer
type Logger interface {
Sub(module string) Logger
GetParent() Logger
Write(p []byte) (n int, err error)
Log(level Level, parts ...interface{})
Logln(level Level, parts ...interface{})
Logf(level Level, message string, args ...interface{})
Logfln(level Level, message string, args ...interface{})
Debug(parts ...interface{})
Debugln(parts ...interface{})
Debugf(message string, args ...interface{})
Debugfln(message string, args ...interface{})
Info(parts ...interface{})
Infoln(parts ...interface{})
Infof(message string, args ...interface{})
Infofln(message string, args ...interface{})
Warn(parts ...interface{})
Warnln(parts ...interface{})
Warnf(message string, args ...interface{})
Warnfln(message string, args ...interface{})
Error(parts ...interface{})
Errorln(parts ...interface{})
Errorf(message string, args ...interface{})
Errorfln(message string, args ...interface{})
Fatal(parts ...interface{})
Fatalln(parts ...interface{})
Fatalf(message string, args ...interface{})
Fatalfln(message string, args ...interface{})
}
// Create a Logger
func Create() *Logger {
var log = &Logger{
func Create() Logger {
var log = &BasicLogger{
PrintLevel: 10,
FileTimeFormat: "2006-01-02",
FileFormat: func(now string, i int) string { return fmt.Sprintf("%[1]s-%02[2]d.log", now, i) },
@ -75,17 +84,21 @@ func Create() *Logger {
FlushLineThreshold: 5,
lines: 0,
}
log.DefaultSub = log.CreateSublogger("", LevelInfo)
log.DefaultSub = log.Sub("")
return log
}
// SetWriter formats the given parts with fmt.Sprint and log them with the SetWriter level
func (log *Logger) SetWriter(w *os.File) {
func (log *BasicLogger) GetParent() Logger {
return nil
}
// SetWriter formats the given parts with fmt.Sprint and logs the result with the SetWriter level
func (log *BasicLogger) SetWriter(w *os.File) {
log.writer = w
}
// OpenFile formats the given parts with fmt.Sprint and log them with the OpenFile level
func (log *Logger) OpenFile() error {
// OpenFile formats the given parts with fmt.Sprint and logs the result with the OpenFile level
func (log *BasicLogger) OpenFile() error {
now := time.Now().Format(log.FileTimeFormat)
i := 1
for ; ; i++ {
@ -106,15 +119,15 @@ func (log *Logger) OpenFile() error {
return nil
}
// Close formats the given parts with fmt.Sprint and log them with the Close level
func (log *Logger) Close() {
// Close formats the given parts with fmt.Sprint and logs the result with the Close level
func (log *BasicLogger) Close() {
if log.writer != nil {
log.writer.Close()
}
}
// Raw formats the given parts with fmt.Sprint and log them with the Raw level
func (log *Logger) Raw(level Level, module, message string) {
// Raw formats the given parts with fmt.Sprint and logs the result with the Raw level
func (log *BasicLogger) Raw(level Level, module, message string) {
if !log.prefixPrinted {
if len(module) == 0 {
message = fmt.Sprintf("[%s] [%s] %s", time.Now().Format(log.TimeFormat), level.Name, message)

View file

@ -1,39 +1,53 @@
// mauLogger - A logger for Go programs
// Copyright (C) 2016 Tulir Asokan
// Copyright (C) 2016-2018 Tulir Asokan
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// Package maulogger ...
package maulogger
import (
"fmt"
)
// Sublogger ...
type Sublogger struct {
Parent *Logger
topLevel *BasicLogger
parent Logger
Module string
DefaultLevel Level
}
// CreateSublogger creates a Sublogger
func (log *Logger) CreateSublogger(module string, DefaultLevel Level) *Sublogger {
// Sub creates a Sublogger
func (log *BasicLogger) Sub(module string) Logger {
return &Sublogger{
Parent: log,
topLevel: log,
parent: log,
Module: module,
DefaultLevel: DefaultLevel,
DefaultLevel: LevelInfo,
}
}
func (log *Sublogger) GetParent() Logger {
return log.parent
}
// Sub creates a Sublogger
func (log *Sublogger) Sub(module string) Logger {
return &Sublogger{
topLevel: log.topLevel,
parent: log,
Module: fmt.Sprintf("%s/%s", log.Module, module),
DefaultLevel: log.DefaultLevel,
}
}
@ -48,102 +62,132 @@ func (log *Sublogger) SetDefaultLevel(lvl Level) {
}
// SetParent changes the parent of this Sublogger
func (log *Sublogger) SetParent(parent *Logger) {
log.Parent = parent
func (log *Sublogger) SetParent(parent *BasicLogger) {
log.topLevel = parent
}
//Write ...
func (log *Sublogger) Write(p []byte) (n int, err error) {
log.Parent.Raw(log.DefaultLevel, log.Module, string(p))
log.topLevel.Raw(log.DefaultLevel, log.Module, string(p))
return len(p), nil
}
// Log formats the given parts with fmt.Sprint and log them with the Log level
// Log formats the given parts with fmt.Sprint and logs the result with the given level
func (log *Sublogger) Log(level Level, parts ...interface{}) {
log.Parent.Raw(level, "", fmt.Sprint(parts...))
log.topLevel.Raw(level, "", fmt.Sprint(parts...))
}
// Logln formats the given parts with fmt.Sprintln and log them with the Log level
// Logln formats the given parts with fmt.Sprintln and logs the result with the given level
func (log *Sublogger) Logln(level Level, parts ...interface{}) {
log.Parent.Raw(level, "", fmt.Sprintln(parts...))
log.topLevel.Raw(level, "", fmt.Sprintln(parts...))
}
// Logf formats the given message and args with fmt.Sprintf and log them with the Log level
// Logf formats the given message and args with fmt.Sprintf and logs the result with the given level
func (log *Sublogger) Logf(level Level, message string, args ...interface{}) {
log.Parent.Raw(level, "", fmt.Sprintf(message, args...))
log.topLevel.Raw(level, "", fmt.Sprintf(message, args...))
}
// Debug formats the given parts with fmt.Sprint and log them with the Debug level
// Logfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the given level
func (log *Sublogger) Logfln(level Level, message string, args ...interface{}) {
log.topLevel.Raw(level, log.Module, fmt.Sprintf(message+"\n", args...))
}
// Debug formats the given parts with fmt.Sprint and logs the result with the Debug level
func (log *Sublogger) Debug(parts ...interface{}) {
log.Parent.Raw(LevelDebug, log.Module, fmt.Sprint(parts...))
log.topLevel.Raw(LevelDebug, log.Module, fmt.Sprint(parts...))
}
// Debugln formats the given parts with fmt.Sprintln and log them with the Debug level
// Debugln formats the given parts with fmt.Sprintln and logs the result with the Debug level
func (log *Sublogger) Debugln(parts ...interface{}) {
log.Parent.Raw(LevelDebug, log.Module, fmt.Sprintln(parts...))
log.topLevel.Raw(LevelDebug, log.Module, fmt.Sprintln(parts...))
}
// Debugf formats the given message and args with fmt.Sprintf and log them with the Debug level
// Debugf formats the given message and args with fmt.Sprintf and logs the result with the Debug level
func (log *Sublogger) Debugf(message string, args ...interface{}) {
log.Parent.Raw(LevelDebug, log.Module, fmt.Sprintf(message, args...))
log.topLevel.Raw(LevelDebug, log.Module, fmt.Sprintf(message, args...))
}
// Info formats the given parts with fmt.Sprint and log them with the Info level
// Debugfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Debug level
func (log *Sublogger) Debugfln(message string, args ...interface{}) {
log.topLevel.Raw(LevelDebug, log.Module, fmt.Sprintf(message+"\n", args...))
}
// Info formats the given parts with fmt.Sprint and logs the result with the Info level
func (log *Sublogger) Info(parts ...interface{}) {
log.Parent.Raw(LevelInfo, log.Module, fmt.Sprint(parts...))
log.topLevel.Raw(LevelInfo, log.Module, fmt.Sprint(parts...))
}
// Infoln formats the given parts with fmt.Sprintln and log them with the Info level
// Infoln formats the given parts with fmt.Sprintln and logs the result with the Info level
func (log *Sublogger) Infoln(parts ...interface{}) {
log.Parent.Raw(LevelInfo, log.Module, fmt.Sprintln(parts...))
log.topLevel.Raw(LevelInfo, log.Module, fmt.Sprintln(parts...))
}
// Infof formats the given message and args with fmt.Sprintf and log them with the Info level
// Infof formats the given message and args with fmt.Sprintf and logs the result with the Info level
func (log *Sublogger) Infof(message string, args ...interface{}) {
log.Parent.Raw(LevelInfo, log.Module, fmt.Sprintf(message, args...))
log.topLevel.Raw(LevelInfo, log.Module, fmt.Sprintf(message, args...))
}
// Warn formats the given parts with fmt.Sprint and log them with the Warn level
// Infofln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Info level
func (log *Sublogger) Infofln(message string, args ...interface{}) {
log.topLevel.Raw(LevelInfo, log.Module, fmt.Sprintf(message+"\n", args...))
}
// Warn formats the given parts with fmt.Sprint and logs the result with the Warn level
func (log *Sublogger) Warn(parts ...interface{}) {
log.Parent.Raw(LevelWarn, log.Module, fmt.Sprint(parts...))
log.topLevel.Raw(LevelWarn, log.Module, fmt.Sprint(parts...))
}
// Warnln formats the given parts with fmt.Sprintln and log them with the Warn level
// Warnln formats the given parts with fmt.Sprintln and logs the result with the Warn level
func (log *Sublogger) Warnln(parts ...interface{}) {
log.Parent.Raw(LevelWarn, log.Module, fmt.Sprintln(parts...))
log.topLevel.Raw(LevelWarn, log.Module, fmt.Sprintln(parts...))
}
// Warnf formats the given message and args with fmt.Sprintf and log them with the Warn level
// Warnf formats the given message and args with fmt.Sprintf and logs the result with the Warn level
func (log *Sublogger) Warnf(message string, args ...interface{}) {
log.Parent.Raw(LevelWarn, log.Module, fmt.Sprintf(message, args...))
log.topLevel.Raw(LevelWarn, log.Module, fmt.Sprintf(message, args...))
}
// Error formats the given parts with fmt.Sprint and log them with the Error level
// Warnfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Warn level
func (log *Sublogger) Warnfln(message string, args ...interface{}) {
log.topLevel.Raw(LevelWarn, log.Module, fmt.Sprintf(message+"\n", args...))
}
// Error formats the given parts with fmt.Sprint and logs the result with the Error level
func (log *Sublogger) Error(parts ...interface{}) {
log.Parent.Raw(LevelError, log.Module, fmt.Sprint(parts...))
log.topLevel.Raw(LevelError, log.Module, fmt.Sprint(parts...))
}
// Errorln formats the given parts with fmt.Sprintln and log them with the Error level
// Errorln formats the given parts with fmt.Sprintln and logs the result with the Error level
func (log *Sublogger) Errorln(parts ...interface{}) {
log.Parent.Raw(LevelError, log.Module, fmt.Sprintln(parts...))
log.topLevel.Raw(LevelError, log.Module, fmt.Sprintln(parts...))
}
// Errorf formats the given message and args with fmt.Sprintf and log them with the Error level
// Errorf formats the given message and args with fmt.Sprintf and logs the result with the Error level
func (log *Sublogger) Errorf(message string, args ...interface{}) {
log.Parent.Raw(LevelError, log.Module, fmt.Sprintf(message, args...))
log.topLevel.Raw(LevelError, log.Module, fmt.Sprintf(message, args...))
}
// Fatal formats the given parts with fmt.Sprint and log them with the Fatal level
// Errorfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Error level
func (log *Sublogger) Errorfln(message string, args ...interface{}) {
log.topLevel.Raw(LevelError, log.Module, fmt.Sprintf(message+"\n", args...))
}
// Fatal formats the given parts with fmt.Sprint and logs the result with the Fatal level
func (log *Sublogger) Fatal(parts ...interface{}) {
log.Parent.Raw(LevelFatal, log.Module, fmt.Sprint(parts...))
log.topLevel.Raw(LevelFatal, log.Module, fmt.Sprint(parts...))
}
// Fatalln formats the given parts with fmt.Sprintln and log them with the Fatal level
// Fatalln formats the given parts with fmt.Sprintln and logs the result with the Fatal level
func (log *Sublogger) Fatalln(parts ...interface{}) {
log.Parent.Raw(LevelFatal, log.Module, fmt.Sprintln(parts...))
log.topLevel.Raw(LevelFatal, log.Module, fmt.Sprintln(parts...))
}
// Fatalf formats the given message and args with fmt.Sprintf and log them with the Fatal level
// Fatalf formats the given message and args with fmt.Sprintf and logs the result with the Fatal level
func (log *Sublogger) Fatalf(message string, args ...interface{}) {
log.Parent.Raw(LevelFatal, log.Module, fmt.Sprintf(message, args...))
log.topLevel.Raw(LevelFatal, log.Module, fmt.Sprintf(message, args...))
}
// Fatalfln formats the given message and args with fmt.Sprintf, appends a newline and logs the result with the Fatal level
func (log *Sublogger) Fatalfln(message string, args ...interface{}) {
log.topLevel.Raw(LevelFatal, log.Module, fmt.Sprintf(message+"\n", args...))
}