mirror of
https://github.com/geode-sdk/geode.git
synced 2025-02-17 00:30:26 -05:00
even more cleaning
This commit is contained in:
parent
c57db81910
commit
b01db1f0fc
4 changed files with 11 additions and 36 deletions
|
@ -50,20 +50,6 @@ namespace geode {
|
|||
using log_clock = std::chrono::system_clock;
|
||||
GEODE_DLL std::string generateLogName();
|
||||
|
||||
// template <class T>
|
||||
// requires std::convertible_to<T*, cocos2d::CCNode*>
|
||||
// std::string serialize(T* node) {
|
||||
// return serialize(static_cast<cocos2d::CCNode*>(node));
|
||||
// }
|
||||
// template <class T>
|
||||
// requires(
|
||||
// std::convertible_to<T*, cocos2d::CCObject*> &&
|
||||
// !std::convertible_to<T*, cocos2d::CCNode*>
|
||||
// )
|
||||
// std::string serialize(T* node) {
|
||||
// return serialize(static_cast<cocos2d::CCObject*>(node));
|
||||
// }
|
||||
|
||||
// Log
|
||||
|
||||
class GEODE_DLL Log final {
|
||||
|
@ -76,9 +62,6 @@ namespace geode {
|
|||
public:
|
||||
~Log();
|
||||
Log(Severity sev, Mod* mod, std::string content);
|
||||
Log(Log&& l) = default;
|
||||
Log& operator=(Log&& l) = default;
|
||||
// bool operator==(Log const& l) const;
|
||||
|
||||
std::string toString(bool logTime = true) const;
|
||||
std::string toString(bool logTime, uint32_t nestLevel) const;
|
||||
|
@ -108,7 +91,7 @@ namespace geode {
|
|||
static void pushNest();
|
||||
static void popNest();
|
||||
|
||||
static std::vector<Log*> list();
|
||||
static std::vector<Log> const& list();
|
||||
static void clear();
|
||||
};
|
||||
|
||||
|
|
|
@ -89,9 +89,11 @@ std::string cocos2d::format_as(cocos2d::ccColor4B const& col) {
|
|||
// Log
|
||||
|
||||
void log::vlogImpl(Severity sev, Mod* mod, fmt::string_view format, fmt::format_args args) {
|
||||
Log obj(sev, mod, fmt::vformat(format, args));
|
||||
|
||||
Logger::push(std::move(obj));
|
||||
Logger::push(Log(
|
||||
sev,
|
||||
mod,
|
||||
fmt::vformat(format, args)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
@ -101,12 +103,7 @@ Log::Log(Severity sev, Mod* mod, std::string content) :
|
|||
m_severity(sev),
|
||||
m_content(std::move(content)) {}
|
||||
|
||||
Log::~Log() {
|
||||
}
|
||||
|
||||
// bool Log::operator==(Log const& l) {
|
||||
// return this == &l;
|
||||
// }
|
||||
Log::~Log() {}
|
||||
|
||||
std::string Log::toString(bool logTime) const {
|
||||
return toString(logTime, 0);
|
||||
|
@ -219,13 +216,8 @@ void Logger::popNest() {
|
|||
nestLevel()--;
|
||||
}
|
||||
|
||||
std::vector<Log*> Logger::list() {
|
||||
std::vector<Log*> logs_;
|
||||
logs_.reserve(logs().size());
|
||||
for (auto& log : logs()) {
|
||||
logs_.push_back(&log);
|
||||
}
|
||||
return logs_;
|
||||
std::vector<Log> const& Logger::list() {
|
||||
return logs();
|
||||
}
|
||||
|
||||
void Logger::clear() {
|
||||
|
|
|
@ -80,7 +80,7 @@ void Loader::Impl::openPlatformConsole() {
|
|||
m_platformConsoleOpen = true;
|
||||
|
||||
for (auto const& log : log::Logger::list()) {
|
||||
this->logConsoleMessageWithSeverity(log->toString(true), log->getSeverity());
|
||||
this->logConsoleMessageWithSeverity(log.toString(true), log.getSeverity());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ void Loader::Impl::openPlatformConsole() {
|
|||
m_platformConsoleOpen = true;
|
||||
|
||||
for (auto const& log : log::Logger::list()) {
|
||||
this->logConsoleMessageWithSeverity(log->toString(true), log->getSeverity());
|
||||
this->logConsoleMessageWithSeverity(log.toString(true), log.getSeverity());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue