Improve logging throughout SDK

Used proper enum for context. The low level tier1 stuff should print in COMMON.
Also added newlines where missing, the logging system will undergo a change where a newline will only be appended if we are logging in the same context without a newline.
This commit is contained in:
Kawe Mazidjatari 2022-11-25 23:03:56 +01:00
parent 8373cc70ca
commit 277e05b2b8
6 changed files with 11 additions and 11 deletions

View File

@ -39,7 +39,7 @@ const char* CNetChan::GetAddress(void) const
if (!inet_ntop(AF_INET6, &this->remote_address.adr, s[useSlot], sizeof(s[0])))
{
Warning(eDLL_T::ENGINE, "%s - Address conversion failed: %s", __FUNCTION__, NET_ErrorString(WSAGetLastError()));
Warning(eDLL_T::ENGINE, "%s - Address conversion failed: %s\n", __FUNCTION__, NET_ErrorString(WSAGetLastError()));
}
// Pray the caller uses it before it gets clobbered
@ -240,7 +240,7 @@ bool CNetChan::ProcessMessages(CNetChan* pChan, bf_read* pMsg)
if (pSlot->m_flCurrentNetProcessTime >
net_processTimeBudget->GetDouble())
{
Warning(eDLL_T::ENGINE, "Removing netchannel '%s' ('%s' exceeded frame budget by '%3.1f'ms!)\n",
Warning(eDLL_T::SERVER, "Removing netchannel '%s' ('%s' exceeded frame budget by '%3.1f'ms!)\n",
pChan->GetName(), pChan->GetAddress(), (pSlot->m_flCurrentNetProcessTime - net_processTimeBudget->GetDouble()));
pClient->Disconnect(Reputation_t::REP_MARK_BAD, "#DISCONNECT_NETCHAN_OVERFLOW");

View File

@ -357,7 +357,7 @@ void CBanSystem::KickPlayerById(const string& svHandle)
}
catch (const std::exception& e)
{
Error(eDLL_T::SERVER, NO_ERROR, "%s - %s", __FUNCTION__, e.what());
Error(eDLL_T::SERVER, NO_ERROR, "%s - %s\n", __FUNCTION__, e.what());
return;
}
}
@ -461,7 +461,7 @@ void CBanSystem::BanPlayerById(const string& svHandle)
}
catch (const std::exception& e)
{
Error(eDLL_T::SERVER, NO_ERROR, "%s - %s", __FUNCTION__, e.what());
Error(eDLL_T::SERVER, NO_ERROR, "%s - %s\n", __FUNCTION__, e.what());
return;
}
}
@ -491,7 +491,7 @@ void CBanSystem::UnbanPlayer(const string& svCriteria)
}
catch (const std::exception& e)
{
Error(eDLL_T::SERVER, NO_ERROR, "%s - %s", __FUNCTION__, e.what());
Error(eDLL_T::SERVER, NO_ERROR, "%s - %s\n", __FUNCTION__, e.what());
return;
}
}

View File

@ -296,7 +296,7 @@ void CUtlFixedMemory<T>::Grow(ssize_t num)
BlockHeader_t* RESTRICT pBlockHeader = (BlockHeader_t*)malloc(sizeof(BlockHeader_t) + nBlockSize * sizeof(T));
if (!pBlockHeader)
{
Error(eDLL_T::ENGINE, EXIT_FAILURE, "CUtlFixedMemory overflow!\n");
Error(eDLL_T::COMMON, EXIT_FAILURE, "CUtlFixedMemory overflow!\n");
}
pBlockHeader->m_pNext = NULL;
pBlockHeader->m_nBlockSize = nBlockSize;

View File

@ -481,7 +481,7 @@ I CUtlLinkedList<T, S, ML, I, M>::AllocInternal(bool multilist)
Assert(m_Memory.IsValidIterator(it));
if (!m_Memory.IsValidIterator(it))
{
ExecuteNTimes(10, Warning(eDLL_T::ENGINE, "CUtlLinkedList overflow! (exhausted memory allocator)\n"));
ExecuteNTimes(10, Warning(eDLL_T::COMMON, "CUtlLinkedList overflow! (exhausted memory allocator)\n"));
return InvalidIndex();
}
}
@ -489,7 +489,7 @@ I CUtlLinkedList<T, S, ML, I, M>::AllocInternal(bool multilist)
// We can overflow before the utlmemory overflows, since S != I
if (!IndexInRange(m_Memory.GetIndex(it)))
{
ExecuteNTimes(10, Warning(eDLL_T::ENGINE, "CUtlLinkedList overflow! (exhausted index range)\n"));
ExecuteNTimes(10, Warning(eDLL_T::COMMON, "CUtlLinkedList overflow! (exhausted index range)\n"));
return InvalidIndex();
}

View File

@ -683,7 +683,7 @@ I CUtlRBTree<T, I, L, M>::NewNode()
Assert(m_Elements.IsValidIterator(it));
if (!m_Elements.IsValidIterator(it))
{
Error(eDLL_T::ENGINE, EXIT_FAILURE, "CUtlRBTree overflow!\n");
Error(eDLL_T::COMMON, EXIT_FAILURE, "CUtlRBTree overflow!\n");
}
}
m_LastAlloc = it;

View File

@ -316,7 +316,7 @@ void Pak_RequestUnload_f(const CCommand& args)
}
catch (const std::exception& e)
{
Error(eDLL_T::RTECH, NO_ERROR, "%s - %s", __FUNCTION__, e.what());
Error(eDLL_T::RTECH, NO_ERROR, "%s - %s\n", __FUNCTION__, e.what());
return;
}
}
@ -379,7 +379,7 @@ void Pak_Swap_f(const CCommand& args)
}
catch (const std::exception& e)
{
Error(eDLL_T::RTECH, NO_ERROR, "%s - %s", __FUNCTION__, e.what());
Error(eDLL_T::RTECH, NO_ERROR, "%s - %s\n", __FUNCTION__, e.what());
return;
}
}