#include "components/media_router/browser/logger_impl.h"
#include <string_view>
#include "base/i18n/time_formatting.h"
#include "base/json/json_string_value_serializer.h"
#include "base/values.h"
#include "components/media_router/browser/log_util.h"
#include "components/media_router/common/media_source.h"
#include "components/media_router/common/mojom/logger.mojom-shared.h"
#include "url/gurl.h"
namespace media_router {
namespace {
constexpr size_t kEntriesCapacity = …;
constexpr size_t kComponentMaxLength = …;
constexpr size_t kMessageMaxLength = …;
constexpr size_t kSourceMaxLength = …;
const char* AsString(LoggerImpl::Severity severity) { … }
const char* AsString(mojom::LogCategory category) { … }
std::string_view TruncateComponent(std::string_view component) { … }
std::string_view TruncateMessage(std::string_view message) { … }
}
LoggerImpl::LoggerImpl() : … { … }
LoggerImpl::~LoggerImpl() { … }
void LoggerImpl::LogInfo(mojom::LogCategory category,
const std::string& component,
const std::string& message,
const std::string& sink_id,
const std::string& media_source,
const std::string& session_id) { … }
void LoggerImpl::LogWarning(mojom::LogCategory category,
const std::string& component,
const std::string& message,
const std::string& sink_id,
const std::string& media_source,
const std::string& session_id) { … }
void LoggerImpl::LogError(mojom::LogCategory category,
const std::string& component,
const std::string& message,
const std::string& sink_id,
const std::string& media_source,
const std::string& session_id) { … }
void LoggerImpl::BindReceiver(mojo::PendingReceiver<mojom::Logger> receiver) { … }
void LoggerImpl::Log(Severity severity,
mojom::LogCategory category,
base::Time time,
const std::string& component,
const std::string& message,
const std::string& sink_id,
const std::string& media_source,
const std::string& session_id) { … }
std::string LoggerImpl::GetLogsAsJson() const { … }
base::Value LoggerImpl::GetLogsAsValue() const { … }
LoggerImpl::Entry::Entry(Severity severity,
mojom::LogCategory category,
base::Time time,
std::string_view component,
std::string_view message,
std::string_view sink_id,
std::string media_source,
std::string_view session_id)
: … { … }
LoggerImpl::Entry::Entry(Entry&& other)
: … { … }
LoggerImpl::Entry::~Entry() = default;
base::Value::Dict LoggerImpl::AsValue(const LoggerImpl::Entry& entry) { … }
}