Documentation
¶
Overview ¶
Package zlog provide daily log service
Index ¶
- Constants
- Variables
- func AddFlag(flag int)
- 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()
- 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()
- func GetAllColorText() map[string]Color
- func GetFlags() int
- func GetLogLevel() int
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func IsSupportColor() bool
- func NewIndentWriter(w io.Writer, pre ...[]byte) io.Writer
- 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)
- func SetFile(filepath string, archive ...bool)
- func SetLogLevel(level int)
- func SetPrefix(prefix string)
- func SetSaveFile(filepath string, archive ...bool)
- 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(logTip string, v ...int)
- func TrackCurrent(max, depth int) (track []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) 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(logTip string, v ...int)
- func (log *Logger) Warn(v ...interface{})
- func (log *Logger) Warnf(format string, v ...interface{})
- type Op
Constants ¶
View Source
const ( BitDate = 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 /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
View Source
const ( LogFatal = iota LogPanic LogError LogWarn LogTips LogSuccess LogInfo LogDebug LogDump LogNot = -1 )
log level
Variables ¶
View Source
var DisableColor = false
DisableColor DisableColor
View Source
var LevelColous = []Color{ ColorRed, ColorLightRed, ColorRed, ColorYellow, ColorWhite, ColorGreen, ColorBlue, ColorLightCyan, ColorCyan, }
View Source
var Levels = []string{
"[FATAL]",
"[PANIC]",
"[ERROR]",
"[WARN] ",
"[TIPS] ",
"[SUCCE]",
"[INFO] ",
"[DEBUG]",
"[DUMP] ",
}
View Source
var (
Log = NewLogs(os.Stderr, "", BitDefault, LogDump, true, 3)
)
Functions ¶
func ColorBackgroundWrap ¶
ColorBackgroundWrap ColorBackgroundWrap
func ColorTextWrap ¶
ColorTextWrap ColorTextWrap
func TrackCurrent ¶
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) ForceConsoleColor ¶
func (log *Logger) ForceConsoleColor()
ForceConsoleColor ForceConsoleColor
func (*Logger) OpTextWrap ¶
OpTextWrap OpTextWrap
func (*Logger) ResetFlags ¶
ResetFlags Reset the GetFlags bitMap tag bit in the log
func (*Logger) SetLogLevel ¶
SetLogLevel Setting log display level
func (*Logger) SetSaveFile ¶
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 )
Click to show internal directories.
Click to hide internal directories.