/thirdparty/breakpad/third_party/glog/src/windows/glog/vlog_is_on.h

http://github.com/tomahawk-player/tomahawk · C++ Header · 133 lines · 31 code · 10 blank · 92 comment · 5 complexity · 8666ca5e51b75edf4bbe2fb85577f10b MD5 · raw file

  1. // This file is automatically generated from src/glog/vlog_is_on.h.in
  2. // using src/windows/preprocess.sh.
  3. // DO NOT EDIT!
  4. // Copyright (c) 1999, 2007, Google Inc.
  5. // All rights reserved.
  6. //
  7. // Redistribution and use in source and binary forms, with or without
  8. // modification, are permitted provided that the following conditions are
  9. // met:
  10. //
  11. // * Redistributions of source code must retain the above copyright
  12. // notice, this list of conditions and the following disclaimer.
  13. // * Redistributions in binary form must reproduce the above
  14. // copyright notice, this list of conditions and the following disclaimer
  15. // in the documentation and/or other materials provided with the
  16. // distribution.
  17. // * Neither the name of Google Inc. nor the names of its
  18. // contributors may be used to endorse or promote products derived from
  19. // this software without specific prior written permission.
  20. //
  21. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. //
  33. // Author: Ray Sidney and many others
  34. //
  35. // Defines the VLOG_IS_ON macro that controls the variable-verbosity
  36. // conditional logging.
  37. //
  38. // It's used by VLOG and VLOG_IF in logging.h
  39. // and by RAW_VLOG in raw_logging.h to trigger the logging.
  40. //
  41. // It can also be used directly e.g. like this:
  42. // if (VLOG_IS_ON(2)) {
  43. // // do some logging preparation and logging
  44. // // that can't be accomplished e.g. via just VLOG(2) << ...;
  45. // }
  46. //
  47. // The truth value that VLOG_IS_ON(level) returns is determined by
  48. // the three verbosity level flags:
  49. // --v=<n> Gives the default maximal active V-logging level;
  50. // 0 is the default.
  51. // Normally positive values are used for V-logging levels.
  52. // --vmodule=<str> Gives the per-module maximal V-logging levels to override
  53. // the value given by --v.
  54. // E.g. "my_module=2,foo*=3" would change the logging level
  55. // for all code in source files "my_module.*" and "foo*.*"
  56. // ("-inl" suffixes are also disregarded for this matching).
  57. //
  58. // SetVLOGLevel helper function is provided to do limited dynamic control over
  59. // V-logging by overriding the per-module settings given via --vmodule flag.
  60. //
  61. // CAVEAT: --vmodule functionality is not available in non gcc compilers.
  62. //
  63. #ifndef BASE_VLOG_IS_ON_H_
  64. #define BASE_VLOG_IS_ON_H_
  65. #include "glog/log_severity.h"
  66. // Annoying stuff for windows -- makes sure clients can import these functions
  67. #ifndef GOOGLE_GLOG_DLL_DECL
  68. # if defined(_WIN32) && !defined(__CYGWIN__)
  69. # define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
  70. # else
  71. # define GOOGLE_GLOG_DLL_DECL
  72. # endif
  73. #endif
  74. #if defined(__GNUC__)
  75. // We emit an anonymous static int* variable at every VLOG_IS_ON(n) site.
  76. // (Normally) the first time every VLOG_IS_ON(n) site is hit,
  77. // we determine what variable will dynamically control logging at this site:
  78. // it's either FLAGS_v or an appropriate internal variable
  79. // matching the current source file that represents results of
  80. // parsing of --vmodule flag and/or SetVLOGLevel calls.
  81. #define VLOG_IS_ON(verboselevel) \
  82. __extension__ \
  83. ({ static google::int32* vlocal__ = &google::kLogSiteUninitialized; \
  84. google::int32 verbose_level__ = (verboselevel); \
  85. (*vlocal__ >= verbose_level__) && \
  86. ((vlocal__ != &google::kLogSiteUninitialized) || \
  87. (google::InitVLOG3__(&vlocal__, &FLAGS_v, \
  88. __FILE__, verbose_level__))); })
  89. #else
  90. // GNU extensions not available, so we do not support --vmodule.
  91. // Dynamic value of FLAGS_v always controls the logging level.
  92. #define VLOG_IS_ON(verboselevel) (FLAGS_v >= (verboselevel))
  93. #endif
  94. // Set VLOG(_IS_ON) level for module_pattern to log_level.
  95. // This lets us dynamically control what is normally set by the --vmodule flag.
  96. // Returns the level that previously applied to module_pattern.
  97. // NOTE: To change the log level for VLOG(_IS_ON) sites
  98. // that have already executed after/during InitGoogleLogging,
  99. // one needs to supply the exact --vmodule pattern that applied to them.
  100. // (If no --vmodule pattern applied to them
  101. // the value of FLAGS_v will continue to control them.)
  102. extern GOOGLE_GLOG_DLL_DECL int SetVLOGLevel(const char* module_pattern,
  103. int log_level);
  104. // Various declarations needed for VLOG_IS_ON above: =========================
  105. // Special value used to indicate that a VLOG_IS_ON site has not been
  106. // initialized. We make this a large value, so the common-case check
  107. // of "*vlocal__ >= verbose_level__" in VLOG_IS_ON definition
  108. // passes in such cases and InitVLOG3__ is then triggered.
  109. extern google::int32 kLogSiteUninitialized;
  110. // Helper routine which determines the logging info for a particalur VLOG site.
  111. // site_flag is the address of the site-local pointer to the controlling
  112. // verbosity level
  113. // site_default is the default to use for *site_flag
  114. // fname is the current source file name
  115. // verbose_level is the argument to VLOG_IS_ON
  116. // We will return the return value for VLOG_IS_ON
  117. // and if possible set *site_flag appropriately.
  118. extern GOOGLE_GLOG_DLL_DECL bool InitVLOG3__(
  119. google::int32** site_flag,
  120. google::int32* site_default,
  121. const char* fname,
  122. google::int32 verbose_level);
  123. #endif // BASE_VLOG_IS_ON_H_