Skip to content

Commit

Permalink
Merge pull request #133 from alliedmodders/logger-logic
Browse files Browse the repository at this point in the history
Move Logger and core natives from core to logic (r=dvander).
  • Loading branch information
psychonic committed Aug 20, 2014
2 parents 233aa5d + e9ba251 commit 09250f8
Show file tree
Hide file tree
Showing 31 changed files with 832 additions and 751 deletions.
1 change: 0 additions & 1 deletion core/AMBuilder
Expand Up @@ -31,7 +31,6 @@ project.sources += [
'smn_console.cpp',
'UserMessages.cpp',
'MenuManager.cpp',
'smn_core.cpp',
'smn_hudtext.cpp',
'smn_usermsgs.cpp',
'MenuStyle_Base.cpp',
Expand Down
6 changes: 3 additions & 3 deletions core/ConsoleDetours.cpp
Expand Up @@ -195,7 +195,7 @@ class GenericCommandHooker : public IConCommandLinkListener
size_t index;
if (!FindVtable(vtable, index))
{
g_Logger.LogError("Console detour tried to unhook command \"%s\" but it wasn't found", pBase->GetName());
logger->LogError("Console detour tried to unhook command \"%s\" but it wasn't found", pBase->GetName());
return;
}

Expand All @@ -219,7 +219,7 @@ class GenericCommandHooker : public IConCommandLinkListener

if (dispatch.thisptroffs < 0)
{
g_Logger.LogError("Command filter could not determine ConCommand layout");
logger->LogError("Command filter could not determine ConCommand layout");
return false;
}

Expand All @@ -228,7 +228,7 @@ class GenericCommandHooker : public IConCommandLinkListener

if (!vtables.size())
{
g_Logger.LogError("Command filter could not find any cvars!");
logger->LogError("Command filter could not find any cvars!");
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions core/CoreConfig.cpp
Expand Up @@ -262,7 +262,7 @@ void CoreConfig::Initialize()
{
/* :TODO: This won't actually log or print anything :( - So fix that somehow */
const char *error = textparsers->GetSMCErrorString(err);
g_Logger.LogFatal("[SM] Error encountered parsing core config file: %s", error ? error : "");
logger->LogFatal("[SM] Error encountered parsing core config file: %s", error ? error : "");
}
}

Expand All @@ -274,7 +274,7 @@ SMCResult CoreConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key,
if (err == ConfigResult_Reject)
{
/* This is a fatal error */
g_Logger.LogFatal("Config error (key: %s) (value: %s) %s", key, value, error);
logger->LogFatal("Config error (key: %s) (value: %s) %s", key, value, error);
}

return SMCResult_Continue;
Expand Down Expand Up @@ -469,7 +469,7 @@ bool SM_ExecuteConfig(IPlugin *pl, AutoConfig *cfg, bool can_create)
}
else
{
g_Logger.LogError("Failed to auto generate config for %s, make sure the directory has write permission.", pl->GetFilename());
logger->LogError("Failed to auto generate config for %s, make sure the directory has write permission.", pl->GetFilename());
return can_create;
}
}
Expand Down
14 changes: 7 additions & 7 deletions core/HalfLife2.cpp
Expand Up @@ -168,7 +168,7 @@ void CHalfLife2::InitLogicalEntData()
if (!addr)
{
// Key exists so notify if lookup fails, but try other method.
g_Logger.LogError("Failed lookup of gEntList directly - Reverting to lookup via LevelShutdown");
logger->LogError("Failed lookup of gEntList directly - Reverting to lookup via LevelShutdown");
}
else
{
Expand All @@ -186,7 +186,7 @@ void CHalfLife2::InitLogicalEntData()
int offset;
if (!g_pGameConf->GetOffset("gEntList", &offset))
{
g_Logger.LogError("Logical Entities not supported by this mod (gEntList) - Reverting to networkable entities only");
logger->LogError("Logical Entities not supported by this mod (gEntList) - Reverting to networkable entities only");
return;
}

Expand All @@ -198,7 +198,7 @@ void CHalfLife2::InitLogicalEntData()
// If we have g_EntList from either of the above methods, make sure we can get the offset from it to EntInfo as well
if (g_EntList && !g_pGameConf->GetOffset("EntInfo", &entInfoOffset))
{
g_Logger.LogError("Logical Entities not supported by this mod (EntInfo) - Reverting to networkable entities only");
logger->LogError("Logical Entities not supported by this mod (EntInfo) - Reverting to networkable entities only");
g_EntList = NULL;
return;
}
Expand All @@ -211,7 +211,7 @@ void CHalfLife2::InitLogicalEntData()

if (!g_EntList && !g_pEntInfoList)
{
g_Logger.LogError("Failed lookup of gEntList - Reverting to networkable entities only");
logger->LogError("Failed lookup of gEntList - Reverting to networkable entities only");
return;
}
}
Expand All @@ -225,7 +225,7 @@ void CHalfLife2::InitCommandLine()
ke::AutoPtr<ILibrary> lib(g_LibSys.OpenLibrary(TIER0_NAME, error, sizeof(error)));
if (lib == NULL)
{
g_Logger.LogError("Could not load %s: %s", TIER0_NAME, error);
logger->LogError("Could not load %s: %s", TIER0_NAME, error);
return;
}

Expand All @@ -242,7 +242,7 @@ void CHalfLife2::InitCommandLine()
ke::AutoPtr<ILibrary> lib(g_LibSys.OpenLibrary(VSTDLIB_NAME, error, sizeof(error)));
if (lib == NULL)
{
g_Logger.LogError("Could not load %s: %s", VSTDLIB_NAME, error);
logger->LogError("Could not load %s: %s", VSTDLIB_NAME, error);
return;
}

Expand All @@ -251,7 +251,7 @@ void CHalfLife2::InitCommandLine()

if (m_pGetCommandLine == NULL)
{
g_Logger.LogError("Could not locate any command line functionality");
logger->LogError("Could not locate any command line functionality");
}
}

Expand Down

0 comments on commit 09250f8

Please sign in to comment.