Documentation ¶
Overview ¶
Package zlog provide daily log service
Index ¶
- Constants
- Variables
- func AddFlag(flag int)deprecated
- func CleanLog(log *Logger)
- func ColorBackgroundWrap(color Color, backgroundColor Color, text string) string
- func ColorTextWrap(color Color, text string) string
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func DisableConsoleColor()deprecated
- func Discard()
- func Dump(v ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, v ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func ForceConsoleColor()deprecated
- func GetAllColorText() map[string]Color
- func GetFlags() intdeprecated
- func GetLogLevel() intdeprecated
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func IsSupportColor() bool
- func OpTextWrap(op Op, text string) string
- func OutAllColor()
- func Panic(v ...interface{})
- func Panicf(format string, v ...interface{})
- func Printf(format string, v ...interface{})
- func Println(v ...interface{})
- func ResetFlags(flag int)deprecated
- func SetDefault(l *Logger)
- func SetFile(filepath string, archive ...bool)deprecated
- func SetLogLevel(level int)deprecated
- func SetPrefix(prefix string)deprecated
- func SetSaveFile(filepath string, archive ...bool)deprecated
- func Stack(v interface{})
- func Success(v ...interface{})
- func Successf(format string, v ...interface{})
- func Tips(v ...interface{})
- func Tipsf(format string, v ...interface{})
- func Track(v string, i ...int)
- func TrimAnsi(str string) string
- func Warn(v ...interface{})
- func Warnf(format string, v ...interface{})
- type Color
- type Format
- type Logger
- func (log *Logger) AddFlag(flag int)
- func (log *Logger) CloseFile()
- func (log *Logger) ColorBackgroundWrap(color Color, backgroundColor Color, text string) string
- func (log *Logger) ColorTextWrap(color Color, text string) string
- func (log *Logger) Debug(v ...interface{})
- func (log *Logger) Debugf(format string, v ...interface{})
- func (log *Logger) DisableConsoleColor()
- func (log *Logger) Discard()
- func (log *Logger) Dump(v ...interface{})
- func (log *Logger) Error(v ...interface{})
- func (log *Logger) Errorf(format string, v ...interface{})
- func (log *Logger) Fatal(v ...interface{})
- func (log *Logger) Fatalf(format string, v ...interface{})
- func (log *Logger) ForceConsoleColor()
- func (log *Logger) GetFlags() int
- func (log *Logger) GetLogLevel() int
- func (log *Logger) GetPrefix() string
- func (log *Logger) Info(v ...interface{})
- func (log *Logger) Infof(format string, v ...interface{})
- func (log *Logger) OpTextWrap(color Op, text string) string
- func (log *Logger) Panic(v ...interface{})
- func (log *Logger) Panicf(format string, v ...interface{})
- func (log *Logger) Printf(format string, v ...interface{})
- func (log *Logger) Println(v ...interface{})
- func (log *Logger) ResetFlags(flag int)
- func (log *Logger) SetFile(filepath string, archive ...bool)
- func (log *Logger) SetIgnoreLog(logs ...string)
- func (log *Logger) SetLogLevel(level int)
- func (log *Logger) SetPrefix(prefix string)
- func (log *Logger) SetSaveFile(filepath string, archive ...bool)
- func (log *Logger) Stack(v interface{})
- func (log *Logger) Success(v ...interface{})
- func (log *Logger) Successf(format string, v ...interface{})
- func (log *Logger) Tips(v ...interface{})
- func (log *Logger) Tipsf(format string, v ...interface{})
- func (log *Logger) Track(v string, i ...int)
- func (log *Logger) Warn(v ...interface{})
- func (log *Logger) Warnf(format string, v ...interface{})
- func (log *Logger) Write(b []byte) (n int, err error)
- func (log *Logger) WriteBefore(fn ...func(level int, log string) bool)
- func (log *Logger) Writer() logWriter
- type Op
Constants ¶
const ( BitDate int = 1 << iota // Date marker 2019/01/23 BitTime // Time Label Bit 01:23:12 BitMicroSeconds // Microsecond label bit 01:23:12.111222 BitLongFile // Full file name, example: /home/go/src/github.com/sohaha/zlsgo/doc.go BitShortFile // Final File name doc.go BitLevel // Current log level BitStdFlag = BitDate | BitTime // Standard header log format BitDefault = BitLevel | BitShortFile | BitTime // Default log header format // LogMaxBuf LogMaxBuf LogMaxBuf = 1024 * 1024 )
log header information tag bit, using bitmap mode
const ( LogFatal = iota LogPanic LogTrack LogError LogWarn LogTips LogSuccess LogInfo LogDebug LogDump LogNot = -1 )
log level
Variables ¶
var DisableColor = false
DisableColor DisableColor
var LevelColous = []Color{ ColorRed, ColorLightRed, ColorLightYellow, ColorRed, ColorYellow, ColorWhite, ColorGreen, ColorBlue, ColorLightCyan, ColorCyan, }
var Levels = []string{
"[FATAL]",
"[PANIC]",
"[TRACK]",
"[ERROR]",
"[WARN] ",
"[TIPS] ",
"[SUCCE]",
"[INFO] ",
"[DEBUG]",
"[DUMP] ",
}
var LogMaxDurationDate = 15
Functions ¶
func ColorBackgroundWrap ¶
ColorBackgroundWrap ColorBackgroundWrap
func ColorTextWrap ¶
ColorTextWrap ColorTextWrap
func DisableConsoleColor
deprecated
func DisableConsoleColor()
Deprecated: please use SetDefault DisableConsoleColor DisableConsoleColor
func ForceConsoleColor
deprecated
func ForceConsoleColor()
Deprecated: please use SetDefault ForceConsoleColor ForceConsoleColor
func GetLogLevel
deprecated
func GetLogLevel() int
Deprecated: please use SetDefault GetLogLevel Setting log display level
func ResetFlags
deprecated
func ResetFlags(flag int)
Deprecated: please use SetDefault ResetFlags Setting Markup Bits
func SetLogLevel
deprecated
func SetLogLevel(level int)
Deprecated: please use SetDefault SetLogLevel Setting log display level
func SetSaveFile
deprecated
added in
v0.1.53
Types ¶
type Color ¶
type Color int
Color Color
const ( // ColorLightGrey light grey ColorLightGrey Color = iota + 90 // ColorLightRed light red ColorLightRed // ColorLightGreen light green ColorLightGreen // ColorLightYellow light yellow ColorLightYellow // ColorLightBlue light blue ColorLightBlue // ColorLightMagenta light magenta ColorLightMagenta // ColorLightCyan lightcyan ColorLightCyan // ColorLightWhite light white ColorLightWhite // ColorDefault ColorDefault ColorDefault = 49 )
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger logger struct
func (*Logger) ColorBackgroundWrap ¶
ColorBackgroundWrap ColorBackgroundWrap
func (*Logger) ColorTextWrap ¶
ColorTextWrap ColorTextWrap
func (*Logger) DisableConsoleColor ¶
func (log *Logger) DisableConsoleColor()
DisableConsoleColor DisableConsoleColor
func (*Logger) Dump ¶ added in v0.0.19
func (log *Logger) Dump(v ...interface{})
Dump pretty print format
func (*Logger) ForceConsoleColor ¶
func (log *Logger) ForceConsoleColor()
ForceConsoleColor ForceConsoleColor
func (*Logger) OpTextWrap ¶
OpTextWrap OpTextWrap
func (*Logger) Printf ¶
Printf formats according to a format specifier and writes to standard output
func (*Logger) ResetFlags ¶
ResetFlags Reset the GetFlags bitMap tag bit in the log
func (*Logger) SetIgnoreLog ¶ added in v1.6.0
func (*Logger) SetLogLevel ¶
SetLogLevel Setting log display level
func (*Logger) SetSaveFile ¶ added in v0.1.33
func (*Logger) WriteBefore ¶ added in v1.7.10
type Op ¶
type Op int
Op Op
const ( // OpReset Reset All Settings OpReset Op = iota // OpBold Bold OpBold // OpFuzzy Fuzzy (not all terminal emulators support it) OpFuzzy // OpItalic Italic (not all terminal emulators support it) OpItalic // OpUnderscore Underline OpUnderscore // OpBlink Twinkle OpBlink // OpFastBlink Fast scintillation (not widely supported) OpFastBlink // OpReverse Reversed Exchange Background and Foreground Colors OpReverse // OpConcealed Concealed OpConcealed // OpStrikethrough Deleted lines (not widely supported) OpStrikethrough )