Skip to content

Commit

Permalink
shift around most logging messages, fix some, add some extra logging
Browse files Browse the repository at this point in the history
added to song load and a couple of file load things
forced default log level to info for everyone
  • Loading branch information
poco0317 committed Dec 3, 2021
1 parent e2385a9 commit 28ba767
Show file tree
Hide file tree
Showing 83 changed files with 380 additions and 290 deletions.
4 changes: 2 additions & 2 deletions src/Etterna/Actor/Menus/MusicWheel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ MusicWheel::SelectSongOrCourse() -> bool
}
}

Locator::getLogger()->trace(
"MusicWheel::MusicWheel() - No selectable songs or courses "
Locator::getLogger()->info(
"MusicWheel::MusicWheel() - No selectable songs "
"found in WheelData");
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Etterna/FileTypes/CsvFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ bool
CsvFile::ReadFile(const std::string& sPath)
{
m_sPath = sPath;
Locator::getLogger()->trace("Reading '{}'", m_sPath.c_str());
Locator::getLogger()->debug("Reading '{}'", m_sPath.c_str());

RageFile f;
if (!f.Open(m_sPath)) {
Locator::getLogger()->trace("Reading '{}' failed: {}", m_sPath.c_str(), f.GetError().c_str());
Locator::getLogger()->warn("Reading '{}' failed: {}", m_sPath.c_str(), f.GetError().c_str());
m_sError = f.GetError();
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Etterna/FileTypes/IniFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ bool
IniFile::ReadFile(const std::string& sPath)
{
m_sPath = sPath;
Locator::getLogger()->trace("Reading '{}'", m_sPath.c_str());
Locator::getLogger()->debug("Reading '{}'", m_sPath.c_str());

RageFile f;
if (!f.Open(m_sPath)) {
Locator::getLogger()->trace("Reading '{}' failed: {}", m_sPath.c_str(), f.GetError().c_str());
Locator::getLogger()->warn("Reading '{}' failed: {}", m_sPath.c_str(), f.GetError().c_str());
m_sError = f.GetError();
return false;
}
Expand Down
9 changes: 6 additions & 3 deletions src/Etterna/Globals/StepMania.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ CheckVideoDefaultSettings()
std::string sDriverRegex = defaults.sDriverRegex;
Regex regex(sDriverRegex);
if (regex.Compare(sVideoDriver)) {
Locator::getLogger()->info("Card matches '{}'.", sDriverRegex.size() ? sDriverRegex.c_str() : "(unknown card)");
Locator::getLogger()->trace("Card matches '{}'.", sDriverRegex.size() ? sDriverRegex.c_str() : "(unknown card)");
break;
}
}
Expand Down Expand Up @@ -1038,7 +1038,10 @@ sm_main(int argc, char* argv[])
// Used to be contents of ApplyLogPreferences
Core::Crash::setShouldUpload(PREFSMAN->m_bEnableCrashUpload);
Core::Platform::setConsoleEnabled(PREFSMAN->m_bShowLogOutput);
Locator::getLogger()->setLogLevel(static_cast<Core::ILogger::Severity>(PREFSMAN->m_logging_level.Get()));
Locator::getLogger()->info("Logging level {} (0 - TRACE | 5 - FATAL)",
PREFSMAN->m_logging_level.Get());
Locator::getLogger()->setLogLevel(
static_cast<Core::ILogger::Severity>(PREFSMAN->m_logging_level.Get()));

// This needs PREFSMAN.
Dialog::Init();
Expand Down Expand Up @@ -1368,7 +1371,7 @@ HandleGlobalInputs(const InputEventPlus& input)
bool bSaveCompressed = bHoldingShift;
RageTimer timer;
StepMania::SaveScreenshot("Screenshots/", bSaveCompressed, "", "");
Locator::getLogger()->trace("Screenshot took {} seconds.", timer.GetDeltaTime());
Locator::getLogger()->debug("Screenshot took {} seconds.", timer.GetDeltaTime());
return true; // handled
}

Expand Down
4 changes: 2 additions & 2 deletions src/Etterna/Globals/global.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "global.h"
#include "global.h"

#include "Core/Crash/CrashpadHandler.hpp"
#include "Core/Services/Locator.hpp"
Expand Down Expand Up @@ -47,7 +47,7 @@ void NORETURN sm_crash(const char* reason) {
#ifdef _WIN32
showCrashDialog(reason);
#endif
Locator::getLogger()->fatal(reason);
Locator::getLogger()->fatal("{}", reason);
Core::Crash::generateMinidump();

_exit(1);
Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Models/Fonts/Font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ Font::LoadFontPageSettings(FontPageSettings& cfg,
cfg.MapRange("numbers", 0, 0, -1);
break;
default:
Locator::getLogger()->trace("Font page \"{}\" has no characters", sTexturePath.c_str());
Locator::getLogger()->warn("Font page \"{}\" has no characters", sTexturePath.c_str());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Models/Misc/DisplaySpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class DisplaySpec
// Drop the trailing ", "
msg.resize(msg.size() - 2);

Locator::getLogger()->warn(msg.c_str());
Locator::getLogger()->warn("{}", msg.c_str());
}
}

Expand Down
30 changes: 17 additions & 13 deletions src/Etterna/Models/Misc/HighScore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ HighScoreImpl::LoadFromEttNode(const XNode* pNode)
auto
HighScoreImpl::WriteReplayData() -> bool
{
Locator::getLogger()->trace("Writing out replay data to disk.");
Locator::getLogger()->info("Writing out replay data to disk");
std::string append;
std::string profiledir;
// These two lines should probably be somewhere else
Expand Down Expand Up @@ -472,7 +472,7 @@ HighScoreImpl::WriteReplayData() -> bool
fileStream.write(append.c_str(), append.size());
}
fileStream.close();
Locator::getLogger()->trace("Created replay file at {}", path.c_str());
Locator::getLogger()->info("Created replay file at {}", path.c_str());
return true;
}

Expand All @@ -490,7 +490,7 @@ auto
HighScoreImpl::WriteInputData() -> bool
{
std::string append;

Locator::getLogger()->info("Writing out Input Data to disk");
// These two lines should probably be somewhere else
if (!FILEMAN->IsADirectory(INPUT_DATA_DIR)) {
FILEMAN->CreateDir(INPUT_DATA_DIR);
Expand Down Expand Up @@ -570,11 +570,11 @@ HighScoreImpl::WriteInputData() -> bool
fclose(infile);
gzclose(outfile);

Locator::getLogger()->trace("Created compressed input data file at {}",
Locator::getLogger()->info("Created compressed input data file at {}",
path_z.c_str());

if (FILEMAN->Remove(path))
Locator::getLogger()->trace("Deleted uncompressed input data");
Locator::getLogger()->debug("Deleted uncompressed input data");
else
Locator::getLogger()->warn(
"Failed to delete uncompressed input data");
Expand Down Expand Up @@ -668,7 +668,7 @@ HighScore::LoadInputData() -> bool

std::ifstream inputStream(path, std::ios::binary);
if (!inputStream) {
Locator::getLogger()->trace("Failed to load input data at {}",
Locator::getLogger()->debug("Failed to load input data at {}",
path.c_str());
return false;
}
Expand Down Expand Up @@ -759,7 +759,7 @@ HighScore::LoadInputData() -> bool
SetMineReplayDataVector(vMineReplayDataVector);
SetHoldReplayDataVector(vHoldReplayDataVector);

Locator::getLogger()->trace("Loaded input data at {}", path.c_str());
Locator::getLogger()->info("Loaded input data at {}", path.c_str());

if (FILEMAN->Remove(path))
Locator::getLogger()->trace("Deleted uncompressed input data");
Expand Down Expand Up @@ -809,7 +809,7 @@ HighScore::LoadReplayDataBasic(const std::string& dir) -> bool

// check file
if (!fileStream) {
Locator::getLogger()->trace("Failed to load replay data at {}", path.c_str());
Locator::getLogger()->warn("Failed to load replay data at {}", path.c_str());
return false;
}

Expand Down Expand Up @@ -859,7 +859,7 @@ HighScore::LoadReplayDataBasic(const std::string& dir) -> bool
SetOffsetVector(vOffsetVector);

m_Impl->ReplayType = 1;
Locator::getLogger()->trace("Loaded replay data type 1 at {}", path.c_str());
Locator::getLogger()->info("Loaded replay data type 1 at {}", path.c_str());
return true;
}

Expand Down Expand Up @@ -920,8 +920,10 @@ HighScore::LoadReplayDataFull(const std::string& dir) -> bool
tokens.size() > 3 ? std::stoi(tokens[3]) : TapNoteSubType_Hold;
if (tmp < 0 || tmp >= NUM_TapNoteSubType ||
!(typeid(tmp) == typeid(int))) {
Locator::getLogger()->warn("Failed to load replay data at {} (\"Tapnotesubtype value is not of type TapNoteSubType\")",
path.c_str());
Locator::getLogger()->warn(
"Failed to load replay data at {} (\"Tapnotesubtype value is "
"not of type TapNoteSubType\")",
path.c_str());
}
hrr.subType = static_cast<TapNoteSubType>(tmp);
vHoldReplayDataVector.emplace_back(hrr);
Expand All @@ -940,7 +942,9 @@ HighScore::LoadReplayDataFull(const std::string& dir) -> bool
a = buffer == "9" || a;
a = buffer == "0" || a;
if (!a) {
Locator::getLogger()->warn("Replay data at {} appears to be HOT BROKEN GARBAGE WTF", path.c_str());
Locator::getLogger()->warn(
"Replay data at {} appears to be HOT BROKEN GARBAGE WTF",
path.c_str());
return false;
}

Expand Down Expand Up @@ -988,7 +992,7 @@ HighScore::LoadReplayDataFull(const std::string& dir) -> bool
SetHoldReplayDataVector(vHoldReplayDataVector);

m_Impl->ReplayType = 2;
Locator::getLogger()->trace("Loaded replay data type 2 at {}", path.c_str());
Locator::getLogger()->info("Loaded replay data type 2 at {}", path.c_str());
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Models/Misc/ImageCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ ImageCache::CacheImage(const std::string& sImageDir,

const auto otImagePath = sImagePath; // Remove this when Global std::string
// to std::string convert.
Locator::getLogger()->trace(otImagePath);
Locator::getLogger()->trace("{}", otImagePath);
if (!DoesFileExist(sImagePath))
return;

Expand Down
2 changes: 1 addition & 1 deletion src/Etterna/Models/Misc/OptionRowHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ class OptionRowHandlerList : public OptionRowHandler
ssprintf("No options in row \"list,%s\" were selected, "
"and no fallback row found; selected entry 0",
m_Def.m_sName.c_str());
Locator::getLogger()->warn(s.c_str());
Locator::getLogger()->warn("{}", s.c_str());
iFallbackOption = 0;
}

Expand Down
26 changes: 13 additions & 13 deletions src/Etterna/Models/Misc/PlayerAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ PlayerAI::ResetScoreData()
void
PlayerAI::SetScoreData(HighScore* pHighScore, int firstRow, NoteData* pNoteData, TimingData* pTimingData)
{
Locator::getLogger()->trace("Setting PlayerAI Score Data");
Locator::getLogger()->info("Setting PlayerAI Score Data");
auto successful = false;
if (pHighScore != nullptr)
successful = pHighScore->LoadReplayData();
Expand All @@ -128,7 +128,7 @@ PlayerAI::SetScoreData(HighScore* pHighScore, int firstRow, NoteData* pNoteData,
m_ReplaySnapshotMap.clear();

if (!successful || pHighScore == nullptr) {
Locator::getLogger()->trace("Exiting Score Data setup - missing HS or ReplayData");
Locator::getLogger()->warn("Exiting Score Data setup - missing HS or ReplayData");
return;
}

Expand Down Expand Up @@ -244,14 +244,14 @@ PlayerAI::SetScoreData(HighScore* pHighScore, int firstRow, NoteData* pNoteData,
// We require the NoteData to validate the Judge count.
// If we don't have it, don't care.
if (pNoteData == nullptr) {
Locator::getLogger()->trace("Exiting Score Data setup - missing NoteData");
Locator::getLogger()->warn("Exiting Score Data setup - missing NoteData");
return;
}

// Set up a mapping of every noterow to a snapshot of what has happened up
// to that point
SetUpSnapshotMap(pNoteData, validNoterows);
Locator::getLogger()->trace("Finished Score Data setup");
Locator::getLogger()->info("Finished Score Data setup");
}

void
Expand Down Expand Up @@ -1040,7 +1040,7 @@ void
PlayerAI::CalculateRadarValuesForReplay(RadarValues& rv,
RadarValues& possibleRV)
{
Locator::getLogger()->trace("Calculating Radar Values from ReplayData");
Locator::getLogger()->info("Calculating Radar Values from ReplayData");
// We will do this thoroughly just in case someone decides to use the
// other categories we don't currently use
auto tapsHit = 0;
Expand Down Expand Up @@ -1113,13 +1113,13 @@ PlayerAI::CalculateRadarValuesForReplay(RadarValues& rv,
rv[RadarCategory_Lifts] = liftsHit;
rv[RadarCategory_Fakes] = fakes;
rv[RadarCategory_Notes] = totalNotesHit;
Locator::getLogger()->trace("Finished Calculating Radar Values from ReplayData");
Locator::getLogger()->info("Finished Calculating Radar Values from ReplayData");
}

void
PlayerAI::SetPlayerStageStatsForReplay(PlayerStageStats* pss, float ts)
{
Locator::getLogger()->trace("Entered PSSFromReplayData function");
Locator::getLogger()->info("Entered PSSFromReplayData function");
// Radar values.
// The possible radar values have already been handled, so we just do
// the real values.
Expand Down Expand Up @@ -1153,7 +1153,7 @@ PlayerAI::SetPlayerStageStatsForReplay(PlayerStageStats* pss, float ts)
pss->m_fLifeRecord = GenerateLifeRecordForReplay(ts);
pss->m_ComboList.clear();
pss->m_ComboList = GenerateComboListForReplay(ts);
Locator::getLogger()->trace("Finished PSSFromReplayData function");
Locator::getLogger()->info("Finished PSSFromReplayData function");
}

std::pair<float, float>
Expand Down Expand Up @@ -1188,7 +1188,7 @@ PlayerAI::GetWifeScoreForRow(int row, float ts)
map<float, float>
PlayerAI::GenerateLifeRecordForReplay(float timingScale)
{
Locator::getLogger()->trace("Generating LifeRecord from ReplayData");
Locator::getLogger()->info("Generating LifeRecord from ReplayData");
// Without a Snapshot Map, I assume we didn't calculate
// the other necessary stuff and this is going to turn out bad
if (m_ReplaySnapshotMap.empty())
Expand Down Expand Up @@ -1256,7 +1256,7 @@ PlayerAI::GenerateLifeRecordForReplay(float timingScale)
}
++holdIter;
} else {
Locator::getLogger()->trace("Somehow while calculating the life graph, something "
Locator::getLogger()->warn("Somehow while calculating the life graph, something "
"went wrong.");
++holdIter;
++tapIter;
Expand All @@ -1267,14 +1267,14 @@ PlayerAI::GenerateLifeRecordForReplay(float timingScale)
lifeRecord[(now - allOffset) / rateUsed] = lifeLevel;
}

Locator::getLogger()->trace("Finished Generating LifeRecord from ReplayData");
Locator::getLogger()->info("Finished Generating LifeRecord from ReplayData");
return lifeRecord;
}

std::vector<PlayerStageStats::Combo_t>
PlayerAI::GenerateComboListForReplay(float timingScale)
{
Locator::getLogger()->trace("Generating ComboList from ReplayData");
Locator::getLogger()->info("Generating ComboList from ReplayData");
std::vector<PlayerStageStats::Combo_t> combos;
const PlayerStageStats::Combo_t firstCombo;
const auto rateUsed = pScoreData->GetMusicRate();
Expand Down Expand Up @@ -1342,6 +1342,6 @@ PlayerAI::GenerateComboListForReplay(float timingScale)
(rowOfComboStart->first - allOffset) / rateUsed;
curCombo->m_fStartSecond = (rowOfComboStart->first - allOffset) / rateUsed;

Locator::getLogger()->trace("Finished Generating ComboList from ReplayData");
Locator::getLogger()->info("Finished Generating ComboList from ReplayData");
return combos;
}
9 changes: 6 additions & 3 deletions src/Etterna/Models/Misc/Preference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,19 @@ IPreference::ReadAllDefaultsFromNode(const XNode* pNode)
void
IPreference::PushValue(lua_State* L) const
{
Locator::getLogger()->trace("The preference value \"{}\" is of a type not supported by Lua", m_sName.c_str());
Locator::getLogger()->warn(
"The preference value \"{}\" is of a type not supported by Lua",
m_sName.c_str());

lua_pushnil(L);
}

void
IPreference::SetFromStack(lua_State* L)
{
Locator::getLogger()->trace("The preference value \"{}\" is of a type not supported by Lua",
m_sName.c_str());
Locator::getLogger()->warn(
"The preference value \"{}\" is of a type not supported by Lua",
m_sName.c_str());

lua_pop(L, 1);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Etterna/Models/Misc/RandomSample.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "Etterna/Globals/global.h"
#include "Etterna/Globals/global.h"
#include "Core/Services/Locator.hpp"
#include "RageUtil/Sound/RageSound.h"
#include "RageUtil/Utils/RageUtil.h"
Expand Down Expand Up @@ -66,7 +66,7 @@ RandomSample::LoadSound(const std::string& sSoundFilePath)

auto* pSS = new RageSound;
if (!pSS->Load(sSoundFilePath)) {
Locator::getLogger()->trace("Error loading \"{}\": {}",
Locator::getLogger()->warn("RandomSample: Error loading \"{}\": {}",
sSoundFilePath.c_str(),
pSS->GetError().c_str());
delete pSS;
Expand Down
Loading

0 comments on commit 28ba767

Please sign in to comment.