forked from tallbl0nde/NX-Activity-Log
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize the loading performance when dealing with a large number of …
…data entries - Fixed APP stuck on black screen when there are a large number of game data entries - Optimized the loading performance of the game data enteries. - Add debug traces. - Bump to v1.5.2 Signed-off-by: Damien Zhao <[email protected]>
- Loading branch information
1 parent
1129748
commit d6cf467
Showing
8 changed files
with
117 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
#ifndef DEBUG_HPP | ||
#define DEBUG_HPP | ||
|
||
#include <string> | ||
#include <mutex> | ||
|
||
//#define ENABLE_DEBUG | ||
|
||
namespace Utils { | ||
extern std::mutex mutex; | ||
void write_log(const std::string& msg); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
#include <fstream> | ||
#include <ctime> | ||
#include "utils/Debug.hpp" | ||
|
||
namespace Utils { | ||
std::mutex mutex; | ||
void write_log(const std::string& msg) { | ||
#ifdef ENABLE_DEBUG | ||
std::time_t currentTime = std::time(nullptr); | ||
std::tm* time = std::localtime(¤tTime); | ||
char buffer[30]; | ||
strftime(buffer, sizeof(buffer), "[%Y-%m-%d %H:%M:%S] ", time); | ||
std::string timestamp(buffer); | ||
|
||
std::lock_guard<std::mutex> lock(Utils::mutex); | ||
std::ofstream file("/switch/NX-Activity-Log/debug.log", std::ios::app); | ||
if (file.is_open()) { | ||
file << timestamp + msg << std::endl; | ||
} | ||
#endif | ||
} | ||
}; |
Oops, something went wrong.