dummylog.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Copyright (C) 2010 CZ NIC
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. #ifndef _ISC_DUMMYLOG_H
  15. #define _ISC_DUMMYLOG_H 1
  16. #include <string>
  17. namespace isc {
  18. namespace log {
  19. /// Are we doing logging?
  20. extern bool denabled;
  21. /**
  22. * \short Prefix into logs.
  23. *
  24. * The prefix is printed in front of every log message in square brackets.
  25. * The usual convention is to put the name of program here.
  26. */
  27. extern std::string dprefix;
  28. /**
  29. * \short Temporary interface to logging.
  30. *
  31. * This is a temporary function to do logging. It has wrong interface currently
  32. * and should be replaced by something else. Its main purpose now is to mark
  33. * places where logging should happen. When it is removed, compiler will do
  34. * our work of finding the places.
  35. *
  36. * The only thing it does is printing the dprogram prefix, message and
  37. * a newline if denabled is true.
  38. *
  39. * There are no tests for this function, since it is only temporary and
  40. * trivial. Tests will be written for the real logging framework when it is
  41. * created.
  42. *
  43. * It has the d in front of the name so it is unlikely anyone will create
  44. * a real logging function with the same name and the place wouldn't be found
  45. * as a compilation error.
  46. *
  47. * @param message The message to log. The real interface will probably have
  48. * more parameters.
  49. * \param error_flag TODO
  50. */
  51. void dlog(const std::string& message, bool error_flag=false);
  52. }
  53. }
  54. #endif // _ISC_DUMMYLOG_H