#include "partition_alloc/partition_alloc_base/logging.h"
#if defined( \
BASE_ALLOCATOR_PARTITION_ALLOCATOR_SRC_PARTITION_ALLOC_PARTITION_ALLOC_BASE_CHECK_H_) || \
defined(BASE_CHECK_H_) || \
defined( \
BASE_ALLOCATOR_PARTITION_ALLOCATOR_SRC_PARTITION_ALLOC_PARTITION_ALLOC_CHECK_H_)
#error "logging.h should not include check.h"
#endif
#include <algorithm>
#include "partition_alloc/build_config.h"
#include "partition_alloc/partition_alloc_base/component_export.h"
#include "partition_alloc/partition_alloc_base/debug/alias.h"
#include "partition_alloc/partition_alloc_base/immediate_crash.h"
#if PA_BUILDFLAG(IS_WIN)
#include <windows.h>
#include <io.h>
#endif
#if PA_BUILDFLAG(IS_POSIX) || PA_BUILDFLAG(IS_FUCHSIA)
#include <unistd.h>
#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#endif
#include "partition_alloc/partition_alloc_base/posix/eintr_wrapper.h"
namespace partition_alloc::internal::logging {
namespace {
int g_min_log_level = …;
#if !PA_BUILDFLAG(IS_WIN)
void WriteToStderr(const char* data, size_t length) { … }
#else
void WriteToStderr(const char* data, size_t length) {
HANDLE handle = ::GetStdHandle(STD_ERROR_HANDLE);
const char* ptr = data;
const char* ptr_end = data + length;
while (ptr < ptr_end) {
DWORD bytes_written = 0;
if (!::WriteFile(handle, ptr, ptr_end - ptr, &bytes_written, nullptr) ||
bytes_written == 0) {
break;
}
ptr += bytes_written;
}
}
#endif
}
void SetMinLogLevel(int level) { … }
int GetMinLogLevel() { … }
bool ShouldCreateLogMessage(int severity) { … }
int GetVlogVerbosity() { … }
void RawLog(int level, const char* message) { … }
}