common: Address feedback

This commit is contained in:
GPUCode 2023-07-03 02:17:03 +03:00
parent 9527bfffed
commit d7b4260389
8 changed files with 29 additions and 16 deletions

View file

@ -202,7 +202,7 @@ public:
return *instance;
}
static void Initialize() {
static void Initialize(std::string_view log_file) {
if (instance) {
LOG_WARNING(Log, "Reinitializing logging backend");
return;
@ -212,8 +212,8 @@ public:
void(FileUtil::CreateDir(log_dir));
Filter filter;
filter.ParseFilterString(Settings::values.log_filter.GetValue());
instance = std::unique_ptr<Impl, decltype(&Deleter)>(new Impl(log_dir + LOG_FILE, filter),
Deleter);
instance = std::unique_ptr<Impl, decltype(&Deleter)>(
new Impl(fmt::format("{}{}", log_dir, log_file), filter), Deleter);
initialization_in_progress_suppress_logging = false;
}
@ -414,8 +414,8 @@ private:
};
} // namespace
void Initialize() {
Impl::Initialize();
void Initialize(std::string_view log_file) {
Impl::Initialize(log_file.empty() ? LOG_FILE : log_file);
}
void Start() {

View file

@ -4,6 +4,7 @@
#pragma once
#include <string_view>
#include "common/logging/filter.h"
namespace Common::Log {
@ -11,7 +12,7 @@ namespace Common::Log {
class Filter;
/// Initializes the logging system. This should be the first thing called in main.
void Initialize();
void Initialize(std::string_view log_file = "");
void Start();

View file

@ -19,7 +19,7 @@ struct Entry {
Class log_class{};
Level log_level{};
const char* filename = nullptr;
unsigned int line_num = 0;
u32 line_num = 0;
std::string function;
std::string message;
};

View file

@ -20,7 +20,7 @@ enum class Level : u8 {
Critical, ///< Major problems during execution that threaten the stability of the entire
///< application.
Count ///< Total number of logging levels
Count, ///< Total number of logging levels
};
/**
@ -100,7 +100,7 @@ enum class Class : u8 {
Movie, ///< Movie (Input Recording) Playback
WebService, ///< Interface to Citra Web Services
RPC_Server, ///< RPC server
Count ///< Total number of logging classes
Count, ///< Total number of logging classes
};
} // namespace Common::Log