A web blog and personal homepage engine written in Go.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
797 B

  1. // Package console implements a colorful logger for Gophertype.
  2. package console
  3. import "github.com/kirsle/golog"
  4. var log *golog.Logger
  5. func init() {
  6. log = golog.GetLogger("gophertype")
  7. log.Configure(&golog.Config{
  8. Colors: golog.ExtendedColor,
  9. Theme: golog.DarkTheme,
  10. })
  11. }
  12. // SetDebug turns debug logging on or off.
  13. func SetDebug(on bool) {
  14. if on {
  15. log.Config.Level = golog.DebugLevel
  16. } else {
  17. log.Config.Level = golog.InfoLevel
  18. }
  19. }
  20. // Info level log.
  21. func Info(msg string, v ...interface{}) {
  22. log.Info(msg, v...)
  23. }
  24. // Debug level log.
  25. func Debug(msg string, v ...interface{}) {
  26. log.Debug(msg, v...)
  27. }
  28. // Warn level log.
  29. func Warn(msg string, v ...interface{}) {
  30. log.Warn(msg, v...)
  31. }
  32. // Error level log.
  33. func Error(msg string, v ...interface{}) {
  34. log.Error(msg, v...)
  35. }