trace.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2013 IBM Corp.
  3. *
  4. * All rights reserved. This program and the accompanying materials
  5. * are made available under the terms of the Eclipse Public License v1.0
  6. * which accompanies this distribution, and is available at
  7. * http://www.eclipse.org/legal/epl-v10.html
  8. *
  9. * Contributors:
  10. * Seth Hoenig
  11. * Allan Stockdill-Mander
  12. * Mike Robertson
  13. */
  14. package mqtt
  15. type (
  16. // Logger interface allows implementations to provide to this package any
  17. // object that implements the methods defined in it.
  18. Logger interface {
  19. Println(v ...interface{})
  20. Printf(format string, v ...interface{})
  21. }
  22. // NOOPLogger implements the logger that does not perform any operation
  23. // by default. This allows us to efficiently discard the unwanted messages.
  24. NOOPLogger struct{}
  25. )
  26. func (NOOPLogger) Println(v ...interface{}) {}
  27. func (NOOPLogger) Printf(format string, v ...interface{}) {}
  28. // Internal levels of library output that are initialised to not print
  29. // anything but can be overridden by programmer
  30. var (
  31. ERROR Logger = NOOPLogger{}
  32. CRITICAL Logger = NOOPLogger{}
  33. WARN Logger = NOOPLogger{}
  34. DEBUG Logger = NOOPLogger{}
  35. )