chromium/third_party/webrtc_overrides/rtc_base/logging.cc

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

// NOTE:
// Since this file includes Chromium headers, it must not include
// third_party/webrtc/rtc_base/logging.h since it defines some of the same
// macros as Chromium does and we'll run into conflicts.

#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
#include <CoreServices/CoreServices.h>
#endif  // OS_MACOSX

#include <algorithm>
#include <atomic>
#include <iomanip>

#include "base/logging.h"
#include "base/notreached.h"
#include "base/strings/string_util.h"
#include "base/threading/platform_thread.h"
#include "third_party/webrtc/rtc_base/string_utils.h"

// This needs to be included after base/logging.h.
#include "third_party/webrtc_overrides/rtc_base/diagnostic_logging.h"
#include "third_party/webrtc_overrides/rtc_base/logging.h"

#if defined(WEBRTC_MAC)
#include "base/apple/osstatus_logging.h"
#endif

// Disable logging when fuzzing, for performance reasons.
// WEBRTC_UNSAFE_FUZZER_MODE is defined by WebRTC's BUILD.gn when
// built with use_libfuzzer or use_drfuzz.
#if defined(WEBRTC_UNSAFE_FUZZER_MODE)
#define WEBRTC_ENABLE_LOGGING
#else
#define WEBRTC_ENABLE_LOGGING
#endif

// From this file we can't use VLOG since it expands into usage of the __FILE__
// macro (for correct filtering). The actual logging call from DIAGNOSTIC_LOG in
// ~DiagnosticLogMessage. Note that the second parameter to the LAZY_STREAM
// macro is not used since the filter check has already been done for
// DIAGNOSTIC_LOG.
#define LOG_LAZY_STREAM_DIRECT(file_name, line_number, sev)

namespace rtc {

void (*g_logging_delegate_function)(const std::string&) =;
void (*g_extra_logging_init_function)(
    void (*logging_delegate_function)(const std::string&)) =;
#ifndef NDEBUG
std::atomic<base::PlatformThreadId> g_init_logging_delegate_thread_id =;
#endif

/////////////////////////////////////////////////////////////////////////////
// Log helper functions
/////////////////////////////////////////////////////////////////////////////

inline int WebRtcSevToChromeSev(LoggingSeverity sev) {}

inline int WebRtcVerbosityLevel(LoggingSeverity sev) {}

// Logs extra information for LOG_E.
static void LogExtra(std::ostringstream* print_stream,
                     LogErrorContext err_ctx,
                     int err,
                     const char* module) {}

DiagnosticLogMessage::DiagnosticLogMessage(const char* file,
                                           int line,
                                           LoggingSeverity severity,
                                           LogErrorContext err_ctx,
                                           int err)
    :{}

DiagnosticLogMessage::DiagnosticLogMessage(const char* file,
                                           int line,
                                           LoggingSeverity severity,
                                           LogErrorContext err_ctx,
                                           int err,
                                           const char* module)
    :{}

DiagnosticLogMessage::~DiagnosticLogMessage() {}

// static
void LogMessage::LogToDebug(int min_sev) {}

void InitDiagnosticLoggingDelegateFunction(
    void (*delegate)(const std::string&)) {}

void SetExtraLoggingInit(
    void (*function)(void (*delegate)(const std::string&))) {}

bool CheckVlogIsOnHelper(rtc::LoggingSeverity severity,
                         const char* file,
                         size_t N) {}

}  // namespace rtc