aboutsummaryrefslogtreecommitdiff
path: root/src/yuzu_cmd/yuzu.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-07-21 15:52:42 -0400
committerLioncash <mathew1800@gmail.com>2018-07-21 16:21:19 -0400
commitd66b43dadfac1e9324fee48e97361e2f858f8af5 (patch)
tree6007104127ffaa62cb5cb94f5c47fadf4c192fb8 /src/yuzu_cmd/yuzu.cpp
parent0f20fa5a1e179bdad07fe1e0e58243d1927274fd (diff)
file_util: Use an enum class for GetUserPath()
Instead of using an unsigned int as a parameter and expecting a user to always pass in the correct values, we can just convert the enum into an enum class and use that type as the parameter type instead, which makes the interface more type safe. We also get rid of the bookkeeping "NUM_" element in the enum by just using an unordered map. This function is generally low-frequency in terms of calls (and I'd hope so, considering otherwise would mean we're slamming the disk with IO all the time) so I'd consider this acceptable in this case.
Diffstat (limited to 'src/yuzu_cmd/yuzu.cpp')
-rw-r--r--src/yuzu_cmd/yuzu.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp
index 24db1065ab..b5392c499b 100644
--- a/src/yuzu_cmd/yuzu.cpp
+++ b/src/yuzu_cmd/yuzu.cpp
@@ -56,6 +56,18 @@ static void PrintVersion() {
std::cout << "yuzu " << Common::g_scm_branch << " " << Common::g_scm_desc << std::endl;
}
+static void InitializeLogging() {
+ Log::Filter log_filter(Log::Level::Debug);
+ log_filter.ParseFilterString(Settings::values.log_filter);
+ Log::SetGlobalFilter(log_filter);
+
+ Log::AddBackend(std::make_unique<Log::ColorConsoleBackend>());
+
+ const std::string& log_dir = FileUtil::GetUserPath(FileUtil::UserPath::LogDir);
+ FileUtil::CreateFullPath(log_dir);
+ Log::AddBackend(std::make_unique<Log::FileBackend>(log_dir + LOG_FILE));
+}
+
/// Application entry point
int main(int argc, char** argv) {
Config config;
@@ -124,14 +136,7 @@ int main(int argc, char** argv) {
LocalFree(argv_w);
#endif
- Log::Filter log_filter(Log::Level::Debug);
- log_filter.ParseFilterString(Settings::values.log_filter);
- Log::SetGlobalFilter(log_filter);
-
- Log::AddBackend(std::make_unique<Log::ColorConsoleBackend>());
- FileUtil::CreateFullPath(FileUtil::GetUserPath(D_LOGS_IDX));
- Log::AddBackend(
- std::make_unique<Log::FileBackend>(FileUtil::GetUserPath(D_LOGS_IDX) + LOG_FILE));
+ InitializeLogging();
MicroProfileOnThreadCreate("EmuThread");
SCOPE_EXIT({ MicroProfileShutdown(); });