Skip to content

Commit

Permalink
Compact logs; add ms to timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
p-sam committed Sep 20, 2019
1 parent 6a2b54e commit 24a2bb4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions sysmodule/src/clock_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void ClockManager::Tick()

if (hz != this->context->freqs[module] && this->context->enabled)
{
FileUtils::LogLine("[mgr] Setting %s clock to %u.%u Mhz", Clocks::GetModuleName((SysClkModule)module, true), hz/1000000, hz/100000 - hz/1000000*10);
FileUtils::LogLine("[mgr] %s clock set : %u.%u Mhz", Clocks::GetModuleName((SysClkModule)module, true), hz/1000000, hz/100000 - hz/1000000*10);
Clocks::SetHz((SysClkModule)module, hz);
this->context->freqs[module] = hz;
}
Expand All @@ -110,22 +110,22 @@ bool ClockManager::RefreshContext()
if(enabled != this->context->enabled)
{
this->context->enabled = enabled;
FileUtils::LogLine("[mgr] " TARGET " was %s", enabled ? "enabled" : "disabled");
FileUtils::LogLine("[mgr] " TARGET " status: %s", enabled ? "enabled" : "disabled");
hasChanged = true;
}

std::uint64_t applicationTid = ProcessManagement::GetCurrentApplicationTid();
if (applicationTid != this->context->applicationTid)
{
FileUtils::LogLine("[mgr] Application TitleID changed to: %016lX", applicationTid);
FileUtils::LogLine("[mgr] TitleID change: %016lX", applicationTid);
this->context->applicationTid = applicationTid;
hasChanged = true;
}

SysClkProfile profile = Clocks::GetCurrentProfile();
if (profile != this->context->profile)
{
FileUtils::LogLine("[mgr] Console profile changed to: %s", Clocks::GetProfileName(profile, true));
FileUtils::LogLine("[mgr] Profile change: %s", Clocks::GetProfileName(profile, true));
this->context->profile = profile;
hasChanged = true;
}
Expand All @@ -142,7 +142,7 @@ bool ClockManager::RefreshContext()
hz = Clocks::GetCurrentHz((SysClkModule)module);
if (hz != 0 && hz != this->context->freqs[module])
{
FileUtils::LogLine("[mgr] %s clock changed to %u.%u Mhz", Clocks::GetModuleName((SysClkModule)module, true), hz/1000000, hz/100000 - hz/1000000*10);
FileUtils::LogLine("[mgr] %s clock change: %u.%u Mhz", Clocks::GetModuleName((SysClkModule)module, true), hz/1000000, hz/100000 - hz/1000000*10);
this->context->freqs[module] = hz;
hasChanged = true;
}
Expand All @@ -152,7 +152,7 @@ bool ClockManager::RefreshContext()
{
if(hz)
{
FileUtils::LogLine("[mgr] %s override changed to %u.%u Mhz", Clocks::GetModuleName((SysClkModule)module, true), hz/1000000, hz/100000 - hz/1000000*10);
FileUtils::LogLine("[mgr] %s override change: %u.%u Mhz", Clocks::GetModuleName((SysClkModule)module, true), hz/1000000, hz/100000 - hz/1000000*10);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion sysmodule/src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Config *Config::CreateDefault()

void Config::Load()
{
FileUtils::LogLine("[cfg] reading %s", this->path.c_str());
FileUtils::LogLine("[cfg] Reading %s", this->path.c_str());

this->Close();
this->mtime = this->CheckModificationTime();
Expand Down
10 changes: 5 additions & 5 deletions sysmodule/src/file_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ void FileUtils::LogLine(const char *format, ...)

if (file)
{
time_t timer = time(NULL);
struct tm* timerTm = localtime(&timer);
struct timespec now;
clock_gettime(CLOCK_REALTIME, &now);
struct tm* nowTm = localtime(&now.tv_sec);

va_start(args, format);
fprintf(file, "[%04d-%02d-%02d %02d:%02d:%02d] ", timerTm->tm_year+1900, timerTm->tm_mon+1, timerTm->tm_mday, timerTm->tm_hour, timerTm->tm_min, timerTm->tm_sec);
fprintf(file, "[%04d-%02d-%02d %02d:%02d:%02d.%03ld] ", nowTm->tm_year+1900, nowTm->tm_mon+1, nowTm->tm_mday, nowTm->tm_hour, nowTm->tm_min, nowTm->tm_sec, now.tv_nsec / 1000000UL);
vfprintf(file, format, args);
fprintf(file, "\n");
fclose(file);
Expand Down Expand Up @@ -111,8 +111,8 @@ Result FileUtils::Initialize()
if (R_SUCCEEDED(rc))
{
FileUtils::RefreshFlags(true);
FileUtils::LogLine("=== " TARGET " " TARGET_VERSION " ===");
g_has_initialized = true;
FileUtils::LogLine("=== " TARGET " " TARGET_VERSION " ===");
}

return rc;
Expand Down

0 comments on commit 24a2bb4

Please sign in to comment.