Documentation ¶
Index ¶
Constants ¶
View Source
const ( DebugLevelString = "debug" InfoLevelString = "info" WarnLevelString = "warn" ErrorLevelString = "error" FatalLevelString = "fatal" )
Log level
View Source
const DefaultTimeFormat = time.RFC3339
DefaultTimeFormat of logger
Variables ¶
This section is empty.
Functions ¶
func CreateLogFile ¶
CreateLogFile create a file and return io.Writer for file manipulation
func LevelToString ¶
LevelToString convert log level to readable string
Types ¶
type Config ¶
type Config struct { Level Level LogFile string TimeFormat string Caller bool UseColor bool UseJSON bool }
Config of logger
type KV ¶
type KV map[string]interface{}
KV is a type for logging with more information this used by with function
type Logger ¶
type Logger interface { // this method is not concurrently safe to acess // preferable to create a new logger instead SetConfig(config *Config) error SetLevel(level Level) error Debug(args ...interface{}) Debugf(format string, args ...interface{}) Debugw(msg string, KV KV) Info(args ...interface{}) Infof(format string, args ...interface{}) Infow(msg string, KV KV) Warn(args ...interface{}) Warnf(format string, args ...interface{}) Warnw(msg string, KV KV) Error(args ...interface{}) Errorf(format string, args ...interface{}) Errorw(msg string, KV KV) Fatal(args ...interface{}) Fatalf(format string, args ...interface{}) Fatalw(msg string, KV KV) }
Logger interface
Click to show internal directories.
Click to hide internal directories.