logging_override_if_enabled.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef MEDIA_BASE_LOGGING_OVERRIDE_IF_ENABLED_H_
  5. #define MEDIA_BASE_LOGGING_OVERRIDE_IF_ENABLED_H_
  6. // Provides a way to override DVLOGs to at build time.
  7. // Warning: Do NOT include this file in .h files to avoid unexpected override.
  8. // TODO(xhwang): Provide a way to choose which |verboselevel| to override.
  9. #include "build/build_config.h"
  10. #include "media/media_buildflags.h"
  11. #if BUILDFLAG(ENABLE_LOGGING_OVERRIDE)
  12. #if !defined(DVLOG)
  13. #error This file must be included after base/logging.h.
  14. #endif
  15. #if BUILDFLAG(IS_FUCHSIA)
  16. #define __DVLOG_0 VLOG(0)
  17. #define __DVLOG_1 VLOG(1)
  18. #define __DVLOG_2 VLOG(2)
  19. #else
  20. #define __DVLOG_0 LOG(INFO)
  21. #define __DVLOG_1 LOG(INFO)
  22. #define __DVLOG_2 LOG(INFO)
  23. #endif // BUILDFLAG(IS_FUCHSIA)
  24. #define __DVLOG_3 EAT_STREAM_PARAMETERS
  25. #define __DVLOG_4 EAT_STREAM_PARAMETERS
  26. #define __DVLOG_5 EAT_STREAM_PARAMETERS
  27. #undef DVLOG
  28. #define DVLOG(verboselevel) __DVLOG_##verboselevel
  29. #endif // BUILDFLAG(ENABLE_LOGGING_OVERRIDE)
  30. #endif // MEDIA_BASE_LOGGING_OVERRIDE_IF_ENABLED_H_