#include "components/optimization_guide/core/optimization_guide_logger.h"
#include "base/logging.h"
#include "base/no_destructor.h"
#include "base/observer_list.h"
#include "base/strings/strcat.h"
#include "components/optimization_guide/core/hints_processing_util.h"
#include "components/optimization_guide/core/optimization_guide_switches.h"
namespace {
constexpr size_t kMaxRecentLogMessages = …;
}
OptimizationGuideLogger::LogMessageBuilder::LogMessageBuilder(
optimization_guide_common::mojom::LogSource log_source,
const std::string& source_file,
int source_line,
OptimizationGuideLogger* optimization_guide_logger)
: … { … }
OptimizationGuideLogger::LogMessageBuilder::~LogMessageBuilder() { … }
OptimizationGuideLogger::LogMessageBuilder&
OptimizationGuideLogger::LogMessageBuilder::operator<<(const char* message) { … }
OptimizationGuideLogger::LogMessageBuilder&
OptimizationGuideLogger::LogMessageBuilder::operator<<(
const std::string& message) { … }
OptimizationGuideLogger::LogMessageBuilder&
OptimizationGuideLogger::LogMessageBuilder::operator<<(const GURL& url) { … }
OptimizationGuideLogger::LogMessageBuilder&
OptimizationGuideLogger::LogMessageBuilder::operator<<(
optimization_guide::proto::RequestContext request_context) { … }
OptimizationGuideLogger::LogMessageBuilder&
OptimizationGuideLogger::LogMessageBuilder::operator<<(
optimization_guide::proto::OptimizationType optimization_type) { … }
OptimizationGuideLogger::LogMessageBuilder&
OptimizationGuideLogger::LogMessageBuilder::operator<<(
optimization_guide::OptimizationTypeDecision optimization_type_decision) { … }
OptimizationGuideLogger::LogMessageBuilder&
OptimizationGuideLogger::LogMessageBuilder::operator<<(
optimization_guide::OptimizationGuideDecision optimization_guide_decision) { … }
OptimizationGuideLogger::LogMessageBuilder&
OptimizationGuideLogger::LogMessageBuilder::operator<<(
optimization_guide::proto::OptimizationTarget optimization_target) { … }
OptimizationGuideLogger::LogMessage::LogMessage(
base::Time event_time,
optimization_guide_common::mojom::LogSource log_source,
const std::string& source_file,
int source_line,
const std::string& message)
: … { … }
OptimizationGuideLogger* OptimizationGuideLogger::GetInstance() { … }
OptimizationGuideLogger::OptimizationGuideLogger()
: … { … }
OptimizationGuideLogger::~OptimizationGuideLogger() = default;
void OptimizationGuideLogger::AddObserver(
OptimizationGuideLogger::Observer* observer) { … }
void OptimizationGuideLogger::RemoveObserver(
OptimizationGuideLogger::Observer* observer) { … }
void OptimizationGuideLogger::OnLogMessageAdded(
base::Time event_time,
optimization_guide_common::mojom::LogSource log_source,
const std::string& source_file,
int source_line,
const std::string& message) { … }
bool OptimizationGuideLogger::ShouldEnableDebugLogs() const { … }