chromium/net/third_party/quiche/overrides/quiche_platform_impl/quiche_logging_impl.h

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef NET_THIRD_PARTY_QUICHE_OVERRIDES_QUICHE_PLATFORM_IMPL_QUICHE_LOGGING_IMPL_H_
#define NET_THIRD_PARTY_QUICHE_OVERRIDES_QUICHE_PLATFORM_IMPL_QUICHE_LOGGING_IMPL_H_

#include <vector>

#include "base/check_op.h"
#include "base/logging.h"
#include "base/notreached.h"
#include "build/build_config.h"
#include "quiche/common/platform/api/quiche_export.h"
#include "third_party/abseil-cpp/absl/base/optimization.h"

#define QUICHE_LOG_IMPL(severity)
#define QUICHE_VLOG_IMPL(verbose_level)
#define QUICHE_LOG_EVERY_N_SEC_IMPL(severity, seconds)
#define QUICHE_LOG_FIRST_N_IMPL(severity, n)
#define QUICHE_DLOG_IMPL(severity)
#define QUICHE_DLOG_IF_IMPL(severity, condition)
#define QUICHE_LOG_IF_IMPL(severity, condition)

#define QUICHE_CHROMIUM_LOG_INFO
#define QUICHE_CHROMIUM_LOG_WARNING
#define QUICHE_CHROMIUM_LOG_ERROR
// TODO(pbos): Make QUICHE_LOG(FATAL) [[noreturn]] when quiche can build with
// -Wunreachable-code-aggressive if LOG(FATAL) is [[noreturn]] which will need
// to be resolved upstream
#define QUICHE_CHROMIUM_LOG_FATAL
#define QUICHE_CHROMIUM_LOG_DFATAL

#define QUICHE_CHROMIUM_DLOG_INFO
#define QUICHE_CHROMIUM_DLOG_WARNING
#define QUICHE_CHROMIUM_DLOG_ERROR
#define QUICHE_CHROMIUM_DLOG_FATAL
#define QUICHE_CHROMIUM_DLOG_DFATAL

#define QUICHE_CHROMIUM_LOG_IF_INFO(condition)
#define QUICHE_CHROMIUM_LOG_IF_WARNING(condition)
#define QUICHE_CHROMIUM_LOG_IF_ERROR(condition)
#define QUICHE_CHROMIUM_LOG_IF_FATAL(condition)
#define QUICHE_CHROMIUM_LOG_IF_DFATAL(condition)

#define QUICHE_CHROMIUM_DLOG_IF_INFO(condition)
#define QUICHE_CHROMIUM_DLOG_IF_WARNING(condition)
#define QUICHE_CHROMIUM_DLOG_IF_ERROR(condition)
#define QUICHE_CHROMIUM_DLOG_IF_FATAL(condition)
#define QUICHE_CHROMIUM_DLOG_IF_DFATAL(condition)

#define QUICHE_DVLOG_IMPL(verbose_level)
#define QUICHE_DVLOG_IF_IMPL(verbose_level, condition)

#define QUICHE_LOG_INFO_IS_ON_IMPL()
#ifdef NDEBUG
#define QUICHE_LOG_WARNING_IS_ON_IMPL
#define QUICHE_LOG_ERROR_IS_ON_IMPL
#else
#define QUICHE_LOG_WARNING_IS_ON_IMPL()
#define QUICHE_LOG_ERROR_IS_ON_IMPL()
#endif
#define QUICHE_DLOG_INFO_IS_ON_IMPL()

#if BUILDFLAG(IS_WIN)
// wingdi.h defines ERROR to be 0. When we call QUICHE_DLOG(ERROR), it gets
// substituted with 0, and it expands to QUICHE_CHROMIUM_DLOG_0. To allow us to
// keep using this syntax, we define this macro to do the same thing as
// QUICHE_CHROMIUM_DLOG_ERROR.
#define QUICHE_CHROMIUM_LOG_0
#define QUICHE_CHROMIUM_DLOG_0
#define QUICHE_CHROMIUM_LOG_IF_0
#define QUICHE_CHROMIUM_DLOG_IF_0
#endif

#define QUICHE_NOTREACHED_IMPL()

#define QUICHE_PLOG_IMPL(severity)

#define QUICHE_CHECK_IMPL(condition)
#define QUICHE_CHECK_EQ_IMPL(val1, val2)
#define QUICHE_CHECK_NE_IMPL(val1, val2)
#define QUICHE_CHECK_LE_IMPL(val1, val2)
#define QUICHE_CHECK_LT_IMPL(val1, val2)
#define QUICHE_CHECK_GE_IMPL(val1, val2)
#define QUICHE_CHECK_GT_IMPL(val1, val2)
#define QUICHE_CHECK_OK_IMPL(value)

#define QUICHE_DCHECK_IMPL(condition)
#define QUICHE_DCHECK_EQ_IMPL(val1, val2)
#define QUICHE_DCHECK_NE_IMPL(val1, val2)
#define QUICHE_DCHECK_LE_IMPL(val1, val2)
#define QUICHE_DCHECK_LT_IMPL(val1, val2)
#define QUICHE_DCHECK_GE_IMPL(val1, val2)
#define QUICHE_DCHECK_GT_IMPL(val1, val2)

namespace quic {
template <typename T>
QUICHE_EXPORT inline std::ostream& operator<<(std::ostream& out,
                                              const std::vector<T>& v) {}
}  // namespace quic

#endif  // NET_THIRD_PARTY_QUICHE_OVERRIDES_QUICHE_PLATFORM_IMPL_QUICHE_LOGGING_IMPL_H_