# README
log
useage example
func main() {
log.Debug("%s", "Hello Debug") //默认用法
log.Info("%s", "Hello Info") //默认用法
log.Warn("%s", "Hello Warn") //默认用法
file := log.NewFile("filename")
file.SetMaxBytes(100)
mylogs := log.NewLog("file", file)
mylogs.SetFormatter(log.NewTextFormat("MESSAGE", log.ModeColor))
mylogs.SetLevel(log.DEBUG)
mylogs.Info("%s", "This is a log test")
std := log.NewLog("std", os.Stdout)
std.SetFormatter(log.NewTextFormat("TIME LEVEL MODULE FILE:LINE MESSAGE", log.ModeColor))
std.Warn("THIS IS WARN TEST")
log.AddLogger(mylogs)
log.GetLogger("file").Info("%s", "This is a logger test")
log.GetLogger("file").Warn("This is a warn test")
log.GetLogger("file").Error("This is a error test")
}
# Functions
AddLogger add a Log to Logger.
ConsoleWithBlue write message to stderr with blue color.
ConsoleWithGreen write message to stderr with red color.
ConsoleWithMagenta write message to stderr with magenta color.
ConsoleWithRed write message to stderr with red color.
ConsoleWithYellow write message to stderr with yellow color.
Debug calls default output to write the log as level debug.
DelLogger delete a named Log.
Display print the data in console.
Error calls default output to write the log as level error.
Errorf returns error interface with error message.
Fatal calls default output to write the log as level fatal.
FuncName get function name.
GetDisplayString return data print string.
GetLogger get Log with name, if not set then returns default Log.
Info calls default output to write the log as level info.
NameWithTime formats string by time.
NewFile create a FileWrite with implements FileWriter interface.
NewLog init a log with default config.
NewTextFormat defines TextFormat.
OutputWithFile write to file, It truncates file before writing.
Panic calls default output to write the log as level panic.
ResetDefaultLogger set default Log with __ROOT__.
SetDefaultLogger set default Log with named Log.
SetLogger update Log.
SetOutput sets default log output.
SetTextFormat sets default log message format.
SetTimeFormat sets default time format, if TIME is enabled.
Stack get stack bytes.
Trace calls default output to write the log as level trace.
Warn calls default output to write the log as level warn.
# Structs
FileWrite implements FileWriter interface.
JSONFormat implements Formatter interface.
KvFormat implements Formatter interface.
Log handler.
NullFormat implements Formatter interface.
Record defines a log message event.
TextFormat implements Formatter interface.