mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-10-17 07:03:02 -04:00
mostly template initializations to prevent undefined behavior in the
(unlikely) chance some of these properties are used
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// LoggingServerApiObserver.cpp
|
||||
// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved.
|
||||
// Copyright 2000-02, Sony Online Entertainment Inc., all rights reserved.
|
||||
// Author: Justin Randall
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
@@ -15,7 +15,7 @@
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
LoggingServerApiObserver::LoggingServerApiObserver() :
|
||||
m_loggingServerApi(new LoggingServerApi(0, ConfigLogServer::getLoggingServerApiQueueSize()))
|
||||
m_loggingServerApi(new LoggingServerApi(0, ConfigLogServer::getLoggingServerApiQueueSize()))
|
||||
{
|
||||
m_loggingServerApi->Connect(ConfigLogServer::getLoggingServerApiAddress(), LoggingServerApi::cDefaultPort, ConfigLogServer::getLoggingServerApiLoginName(), ConfigLogServer::getLoggingServerApiPassword(), ConfigLogServer::getLoggingServerApiDefaultDirectory());
|
||||
}
|
||||
@@ -47,30 +47,30 @@ LogObserver * LoggingServerApiObserver::create(const std::string &)
|
||||
void LoggingServerApiObserver::log(const LogMessage & msg)
|
||||
{
|
||||
std::string fileName = "misc.txt";
|
||||
|
||||
|
||||
std::string msgText;
|
||||
|
||||
if(! msg.getText().empty())
|
||||
if (!msg.getText().empty())
|
||||
{
|
||||
time_t now;
|
||||
tm t;
|
||||
|
||||
IGNORE_RETURN( time(&now) );
|
||||
IGNORE_RETURN( gmtime_r(&now, &t) );
|
||||
char dirBuf[128] = {"\0"};
|
||||
IGNORE_RETURN(time(&now));
|
||||
IGNORE_RETURN(gmtime_r(&now, &t));
|
||||
char dirBuf[128] = { "\0" };
|
||||
snprintf(dirBuf, sizeof(dirBuf), "%d/%d/%d/", t.tm_year + 1900, t.tm_mon + 1, t.tm_mday);
|
||||
fileName = ConfigLogServer::getClusterName();
|
||||
fileName += "/";
|
||||
fileName += dirBuf;
|
||||
|
||||
|
||||
std::string splittext = msg.getText();
|
||||
if(splittext.find(":") != splittext.npos)
|
||||
if (splittext.find(":") != splittext.npos)
|
||||
{
|
||||
fileName += splittext.substr(0, splittext.find(":")) + ".txt";
|
||||
}
|
||||
|
||||
msgText = splittext.substr(splittext.find(":") + 1);
|
||||
|
||||
|
||||
// If there is ANY Unicode, send the whole log as Unicode. If there is ONLY non-Unicode, then send the log non-Unicode.
|
||||
|
||||
if (!msg.getUnicodeAttach().empty())
|
||||
@@ -106,7 +106,7 @@ void LoggingServerApiObserver::flush()
|
||||
|
||||
void LoggingServerApiObserver::update()
|
||||
{
|
||||
if(m_loggingServerApi->GetStatus() == LoggingServerApi::cStatusDisconnected)
|
||||
if (m_loggingServerApi->GetStatus() == LoggingServerApi::cStatusDisconnected)
|
||||
{
|
||||
m_loggingServerApi->Connect(ConfigLogServer::getLoggingServerApiAddress(), LoggingServerApi::cDefaultPort, ConfigLogServer::getLoggingServerApiLoginName(), ConfigLogServer::getLoggingServerApiPassword(), ConfigLogServer::getLoggingServerApiDefaultDirectory());
|
||||
}
|
||||
@@ -114,5 +114,4 @@ void LoggingServerApiObserver::update()
|
||||
m_loggingServerApi->GiveTime();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user