logger.go 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. package logger
  2. import (
  3. "log"
  4. "os"
  5. )
  6. // Interface provides the minimal logging interface
  7. type Interface interface {
  8. // Printf prints to the logger using the format.
  9. Printf(format string, v ...interface{})
  10. // Print prints to the logger.
  11. Print(v ...interface{})
  12. // Println prints new line.
  13. Println(v ...interface{})
  14. // Fatal is equivalent to Print() followed by a call to os.Exit(1).
  15. Fatal(v ...interface{})
  16. // Fatalf is equivalent to Printf() followed by a call to os.Exit(1).
  17. Fatalf(format string, v ...interface{})
  18. // Fatalln is equivalent to Println() followed by a call to os.Exit(1).
  19. Fatalln(v ...interface{})
  20. // Panic is equivalent to Print() followed by a call to panic().
  21. Panic(v ...interface{})
  22. // Panicf is equivalent to Printf() followed by a call to panic().
  23. Panicf(format string, v ...interface{})
  24. // Panicln is equivalent to Println() followed by a call to panic().
  25. Panicln(v ...interface{})
  26. }
  27. // DefaultLogger logs messages to os.Stdout
  28. var DefaultLogger = log.New(os.Stdout, "", log.LstdFlags)