#include "components/metrics/metrics_service_observer.h"
#include <string_view>
#include "base/base64.h"
#include "base/callback_list.h"
#include "base/files/file_util.h"
#include "base/json/json_string_value_serializer.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "base/values.h"
#include "components/metrics/metrics_logs_event_manager.h"
namespace metrics {
namespace {
MetricsServiceObserver::Log::Event CreateEventStruct(
MetricsLogsEventManager::LogEvent event,
std::string_view message) { … }
std::string LogTypeToString(MetricsLog::LogType log_type) { … }
std::string EventToString(MetricsLogsEventManager::LogEvent event) { … }
std::string CreateReasonToString(
metrics::MetricsLogsEventManager::CreateReason reason) { … }
}
MetricsServiceObserver::MetricsServiceObserver(MetricsServiceType service_type)
: … { … }
MetricsServiceObserver::~MetricsServiceObserver() = default;
MetricsServiceObserver::Log::Log() = default;
MetricsServiceObserver::Log::Log(const Log&) = default;
MetricsServiceObserver::Log& MetricsServiceObserver::Log::operator=(
const Log&) = default;
MetricsServiceObserver::Log::~Log() = default;
MetricsServiceObserver::Log::Event::Event() = default;
MetricsServiceObserver::Log::Event::Event(const Event&) = default;
MetricsServiceObserver::Log::Event&
MetricsServiceObserver::Log::Event::operator=(const Event&) = default;
MetricsServiceObserver::Log::Event::~Event() = default;
void MetricsServiceObserver::OnLogCreated(
std::string_view log_hash,
std::string_view log_data,
std::string_view log_timestamp,
metrics::MetricsLogsEventManager::CreateReason reason) { … }
void MetricsServiceObserver::OnLogEvent(MetricsLogsEventManager::LogEvent event,
std::string_view log_hash,
std::string_view message) { … }
void MetricsServiceObserver::OnLogType(
std::optional<MetricsLog::LogType> log_type) { … }
bool MetricsServiceObserver::ExportLogsAsJson(bool include_log_proto_data,
std::string* json_output) { … }
void MetricsServiceObserver::ExportLogsToFile(const base::FilePath& path) { … }
base::CallbackListSubscription MetricsServiceObserver::AddNotifiedCallback(
base::RepeatingClosure callback) { … }
MetricsServiceObserver::Log* MetricsServiceObserver::GetLogFromHash(
std::string_view log_hash) { … }
}