loggers.go 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // MIT License
  2. // Copyright (c) 2017 Birkir A. Barkarson
  3. // Permission is hereby granted, free of charge, to any person obtaining a copy
  4. // of this software and associated documentation files (the "Software"), to deal
  5. // in the Software without restriction, including without limitation the rights
  6. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. // copies of the Software, and to permit persons to whom the Software is
  8. // furnished to do so, subject to the following conditions:
  9. // The above copyright notice and this permission notice shall be included in all
  10. // copies or substantial portions of the Software.
  11. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  17. // SOFTWARE.
  18. package loggers
  19. // Standard is the interface used by Go's standard library's log package.
  20. type Standard interface {
  21. Fatal(args ...interface{})
  22. Fatalf(format string, args ...interface{})
  23. Fatalln(args ...interface{})
  24. Panic(args ...interface{})
  25. Panicf(format string, args ...interface{})
  26. Panicln(args ...interface{})
  27. Print(args ...interface{})
  28. Printf(format string, args ...interface{})
  29. Println(args ...interface{})
  30. }
  31. // Advanced is an interface with commonly used log level methods.
  32. type Advanced interface {
  33. Standard
  34. Debug(args ...interface{})
  35. Debugf(format string, args ...interface{})
  36. Debugln(args ...interface{})
  37. Error(args ...interface{})
  38. Errorf(format string, args ...interface{})
  39. Errorln(args ...interface{})
  40. Info(args ...interface{})
  41. Infof(format string, args ...interface{})
  42. Infoln(args ...interface{})
  43. Warn(args ...interface{})
  44. Warnf(format string, args ...interface{})
  45. Warnln(args ...interface{})
  46. }
  47. // Contextual is an interface that allows context addition to a log statement before
  48. // calling the final print (message/level) method.
  49. type Contextual interface {
  50. Advanced
  51. WithField(key string, value interface{}) Advanced
  52. WithFields(fields ...interface{}) Advanced
  53. }