dummylog.h 2.1 KB

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