#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/test/chromedriver/logging.h"
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <cmath>
#include <memory>
#include <utility>
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/json/json_reader.h"
#include "base/logging.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/test/chromedriver/capabilities.h"
#include "chrome/test/chromedriver/chrome/console_logger.h"
#include "chrome/test/chromedriver/chrome/status.h"
#include "chrome/test/chromedriver/command_listener_proxy.h"
#include "chrome/test/chromedriver/constants/version.h"
#include "chrome/test/chromedriver/devtools_events_logger.h"
#include "chrome/test/chromedriver/performance_logger.h"
#include "chrome/test/chromedriver/session.h"
#if BUILDFLAG(IS_POSIX)
#include <fcntl.h>
#include <unistd.h>
#elif BUILDFLAG(IS_WIN)
#include <windows.h>
#endif
const char* GetPortProtectionMessage() { … }
namespace {
Log::Level g_log_level = …;
int64_t g_start_time = …;
bool readable_timestamp;
const char* const kLevelToName[] = …;
const char* LevelToName(Log::Level level) { … }
struct LevelPair { … };
const LevelPair kNameToLevel[] = …;
Log::Level GetLevelFromSeverity(int severity) { … }
WebDriverLog* GetSessionLog() { … }
bool InternalIsVLogOn(int vlog_level) { … }
bool HandleLogMessage(int severity,
const char* file,
int line,
size_t message_start,
const std::string& str) { … }
}
const char WebDriverLog::kBrowserType[] = …;
const char WebDriverLog::kDriverType[] = …;
const char WebDriverLog::kPerformanceType[] = …;
const char WebDriverLog::kDevToolsType[] = …;
bool WebDriverLog::NameToLevel(const std::string& name, Log::Level* out_level) { … }
WebDriverLog::WebDriverLog(const std::string& type, Log::Level min_level)
: … { … }
WebDriverLog::~WebDriverLog() { … }
base::Value::List WebDriverLog::GetAndClearEntries() { … }
bool GetFirstErrorMessageFromList(const base::Value::List& list,
std::string* message) { … }
std::string WebDriverLog::GetFirstErrorMessage() const { … }
void WebDriverLog::AddEntryTimestamped(const base::Time& timestamp,
Log::Level level,
const std::string& source,
const std::string& message) { … }
bool WebDriverLog::Emptied() const { … }
const std::string& WebDriverLog::type() const { … }
void WebDriverLog::set_min_level(Level min_level) { … }
Log::Level WebDriverLog::min_level() const { … }
bool InitLogging() { … }
Status CreateLogs(
const Capabilities& capabilities,
const Session* session,
std::vector<std::unique_ptr<WebDriverLog>>* out_logs,
std::vector<std::unique_ptr<DevToolsEventListener>>* out_devtools_listeners,
std::vector<std::unique_ptr<CommandListener>>* out_command_listeners) { … }