chromium/third_party/ipcz/src/standalone/base/logging.cc

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

#include "standalone/base/logging.h"

#include <atomic>
#include <iostream>

#include "build/build_config.h"
#include "third_party/abseil-cpp/absl/base/log_severity.h"

#if BUILDFLAG(IS_POSIX)
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#endif

#if BUILDFLAG(IS_WIN)
#include <windows.h>
#endif

#if defined(THREAD_SANITIZER)
#include "third_party/abseil-cpp/absl/synchronization/mutex.h"
#endif

namespace ipcz::standalone {

namespace {

std::atomic_int g_verbosity_level{};

#if defined(THREAD_SANITIZER)
// Accessing std::cerr is supposed to be thread-safe, but it was triggering
// TSAN data race warnings. We explicitly guard it with a Mutex here to avoid
// any potential issues for now.
absl::Mutex* GetCerrMutex() {
  static absl::Mutex* mutex = new absl::Mutex();
  return mutex;
}
#endif

}  // namespace

LogMessage::LogMessage(const char* file, int line, Level level) {}

LogMessage::~LogMessage() {}

void SetVerbosityLevel(int level) {}

int GetVerbosityLevel() {}

}  // namespace ipcz::standalone