Documentation ¶
Index ¶
- Constants
- Variables
- func CheckLogDir(dir string) error
- func Debug(v ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, args ...interface{})
- func GetLevel() golog.Level
- func Info(v ...interface{})
- func Infof(format string, args ...interface{})
- func InitFileRotateLogger(baseLogPath string, logSaveDay int, logRotateHour int) error
- func OnceInfoLog(key string, fmtStr string, args ...interface{})
- func ParseLevel(raw string) (golog.Level, error)
- func Print(v ...interface{})
- func Printf(format string, args ...interface{})
- func Println(v ...interface{})
- func ReloadLogLevel(c *Config)
- func SetConfig(c *Config)
- func SetLevel(level golog.Level)
- func SetLoggerConfig(l *Logger, c *Config)
- func SetOutput(w io.Writer)
- func Warn(v ...interface{})
- func Warnf(format string, args ...interface{})
- func Warningf(raw string, args ...interface{})
- type Config
- type FileConfig
- type Logger
- type LoggerConfig
Constants ¶
const ( DebugLevel = golog.DebugLevel InfoLevel = golog.InfoLevel WarnLevel = golog.WarnLevel ErrorLevel = golog.ErrorLevel FatalLevel = golog.FatalLevel PanicLevel = golog.FatalLevel TraceLevel = golog.DebugLevel )
const IGNOREFLAG = `[IGNORE]`
Variables ¶
var ( Trace = Debug Tracef = Debugf )
Trace is named after Debug
var DefaultLogger = GetLogger("default")
var (
ErrUnknowLevel = errors.New("unknown log level")
)
var (
Level = os.Getenv("LOG_LEVEL")
)
Functions ¶
func CheckLogDir ¶
func Debugf ¶
func Debugf(format string, args ...interface{})
Debugf will print when logger's Level is debug.
func Error ¶
func Error(v ...interface{})
Error will print only when logger's Level is error, warn, info or debug.
func Errorf ¶
func Errorf(format string, args ...interface{})
Errorf will print only when logger's Level is error, warn, info or debug.
func Fatal ¶
func Fatal(v ...interface{})
Fatal `os.Exit(1)` exit no matter the level of the logger. If the logger's level is fatal, error, warn, info or debug then it will print the log message too.
func Fatalf ¶
func Fatalf(format string, args ...interface{})
Fatalf will `os.Exit(1)` no matter the level of the logger. If the logger's level is fatal, error, warn, info or debug then it will print the log message too.
func Infof ¶
func Infof(format string, args ...interface{})
Infof will print when logger's Level is info or debug.
func InitFileRotateLogger ¶
func OnceInfoLog ¶ added in v1.3.2
func Printf ¶
func Printf(format string, args ...interface{})
Printf formats according to a format specifier and writes to `Printer#Output` without levels and colors.
func Println ¶
func Println(v ...interface{})
Println prints a log message without levels and colors. It adds a new line at the end, it overrides the `NewLine` option.
func ReloadLogLevel ¶
func ReloadLogLevel(c *Config)
func SetLoggerConfig ¶
Types ¶
type Config ¶
type Config struct { Level string FileConfig FileConfig `json:"file_config" yaml:"file_config"` Loggers map[string]LoggerConfig }
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
type FileConfig ¶
type LoggerConfig ¶
type LoggerConfig struct {
Level string
}