Documentation ¶
Overview ¶
Example ¶
package main import ( "github.com/chai2010/logger" ) func main() { var logger = logger.GetLogger() logger.SetLevel("DEBUG") logger.Debug("1+1=2") logger.Info("hello") }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface { Debug(v ...interface{}) Debugln(v ...interface{}) Debugf(format string, v ...interface{}) Info(v ...interface{}) Infoln(v ...interface{}) Infof(format string, v ...interface{}) Warning(v ...interface{}) Warningln(v ...interface{}) Warningf(format string, v ...interface{}) Error(v ...interface{}) Errorln(v ...interface{}) Errorf(format string, v ...interface{}) Panic(v ...interface{}) Panicln(v ...interface{}) Panicf(format string, v ...interface{}) Fatal(v ...interface{}) Fatalln(v ...interface{}) Fatalf(format string, v ...interface{}) // Level: DEBUG < INFO < WARN < ERROR < PANIC < FATAL GetLevel() string SetLevel(new string) (old string) }
Logger interface
See https://github.com/chai2010/logger
func NewStdLogger ¶
NewStdLogger create new logger based on std log. If level is empty string, use WARN as the default level. If flag is zore, use 'log.LstdFlags|log.Lshortfile' as the default flag. Level: DEBUG < INFO < WARN < ERROR < PANIC < FATAL
Example ¶
package main import ( "log" "os" "github.com/chai2010/logger" ) func main() { var logger = logger.NewStdLogger(os.Stderr, "", "", log.Lshortfile) logger.Debug("1+1=2") logger.Info("hello") }
Output:
Click to show internal directories.
Click to hide internal directories.