diff options
| author | Spp <spp@jorge.gr> | 2013-05-13 15:07:36 +0200 |
|---|---|---|
| committer | Spp <spp@jorge.gr> | 2013-05-13 15:07:36 +0200 |
| commit | d1677b2db08f71a5bddedd9659cc5a66f325f47f (patch) | |
| tree | afb68e15d84d4e64de9f80b9bbbeb126c4aa8c54 /src/server/worldserver/RemoteAccess | |
| parent | 243c325ca4323feb4f7f80c0ecd3873c78cbf887 (diff) | |
Core/Logging: Performance-related tweaks to logging system
All sLog->out* functions (except outCommand atm) are replaced with TC_LOG_* macros.
Memleak fix
Diffstat (limited to 'src/server/worldserver/RemoteAccess')
| -rw-r--r-- | src/server/worldserver/RemoteAccess/RARunnable.cpp | 6 | ||||
| -rw-r--r-- | src/server/worldserver/RemoteAccess/RASocket.cpp | 30 |
2 files changed, 18 insertions, 18 deletions
diff --git a/src/server/worldserver/RemoteAccess/RARunnable.cpp b/src/server/worldserver/RemoteAccess/RARunnable.cpp index 8d57ef6c3b2..edb7e048aa3 100644 --- a/src/server/worldserver/RemoteAccess/RARunnable.cpp +++ b/src/server/worldserver/RemoteAccess/RARunnable.cpp @@ -67,11 +67,11 @@ void RARunnable::run() if (acceptor.open(listen_addr, m_Reactor) == -1) { - sLog->outError(LOG_FILTER_WORLDSERVER, "Trinity RA can not bind to port %d on %s", raport, stringip.c_str()); + TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "Trinity RA can not bind to port %d on %s", raport, stringip.c_str()); return; } - sLog->outInfo(LOG_FILTER_WORLDSERVER, "Starting Trinity RA on port %d on %s", raport, stringip.c_str()); + TC_LOG_INFO(LOG_FILTER_WORLDSERVER, "Starting Trinity RA on port %d on %s", raport, stringip.c_str()); while (!World::IsStopped()) { @@ -82,5 +82,5 @@ void RARunnable::run() break; } - sLog->outDebug(LOG_FILTER_WORLDSERVER, "Trinity RA thread exiting"); + TC_LOG_DEBUG(LOG_FILTER_WORLDSERVER, "Trinity RA thread exiting"); } diff --git a/src/server/worldserver/RemoteAccess/RASocket.cpp b/src/server/worldserver/RemoteAccess/RASocket.cpp index 359abd39901..fa5fdfd3ca0 100644 --- a/src/server/worldserver/RemoteAccess/RASocket.cpp +++ b/src/server/worldserver/RemoteAccess/RASocket.cpp @@ -46,18 +46,18 @@ int RASocket::open(void *) if (peer().get_remote_addr(remote_addr) == -1) { - sLog->outError(LOG_FILTER_WORLDSERVER, "RASocket::open: peer().get_remote_addr error is %s", ACE_OS::strerror(errno)); + TC_LOG_ERROR(LOG_FILTER_WORLDSERVER, "RASocket::open: peer().get_remote_addr error is %s", ACE_OS::strerror(errno)); return -1; } - sLog->outInfo(LOG_FILTER_REMOTECOMMAND, "Incoming connection from %s", remote_addr.get_host_addr()); + TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "Incoming connection from %s", remote_addr.get_host_addr()); return activate(); } int RASocket::handle_close(ACE_HANDLE, ACE_Reactor_Mask) { - sLog->outInfo(LOG_FILTER_REMOTECOMMAND, "Closing connection"); + TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "Closing connection"); peer().close_reader(); wait(); // While the above wait() will wait for the ::svc() to finish, it will not wait for the async event @@ -135,7 +135,7 @@ int RASocket::recv_line(std::string& out_line) if (recv_line(message_block) == -1) { - sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Recv error %s", ACE_OS::strerror(errno)); + TC_LOG_DEBUG(LOG_FILTER_REMOTECOMMAND, "Recv error %s", ACE_OS::strerror(errno)); return -1; } @@ -149,7 +149,7 @@ int RASocket::process_command(const std::string& command) if (command.length() == 0) return 0; - sLog->outInfo(LOG_FILTER_REMOTECOMMAND, "Received command: %s", command.c_str()); + TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "Received command: %s", command.c_str()); // handle quit, exit and logout commands to terminate connection if (command == "quit" || command == "exit" || command == "logout") { @@ -198,7 +198,7 @@ int RASocket::check_access_level(const std::string& user) if (!result) { - sLog->outInfo(LOG_FILTER_REMOTECOMMAND, "User %s does not exist in database", user.c_str()); + TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "User %s does not exist in database", user.c_str()); return -1; } @@ -206,12 +206,12 @@ int RASocket::check_access_level(const std::string& user) if (fields[1].GetUInt8() < _minLevel) { - sLog->outInfo(LOG_FILTER_REMOTECOMMAND, "User %s has no privilege to login", user.c_str()); + TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "User %s has no privilege to login", user.c_str()); return -1; } else if (fields[2].GetInt32() != -1) { - sLog->outInfo(LOG_FILTER_REMOTECOMMAND, "User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str()); + TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str()); return -1; } @@ -237,7 +237,7 @@ int RASocket::check_password(const std::string& user, const std::string& pass) if (!result) { - sLog->outInfo(LOG_FILTER_REMOTECOMMAND, "Wrong password for user: %s", user.c_str()); + TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "Wrong password for user: %s", user.c_str()); return -1; } @@ -260,7 +260,7 @@ int RASocket::authenticate() if (recv_line(pass) == -1) return -1; - sLog->outInfo(LOG_FILTER_REMOTECOMMAND, "Login attempt for user: %s", user.c_str()); + TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "Login attempt for user: %s", user.c_str()); if (check_access_level(user) == -1) return -1; @@ -268,7 +268,7 @@ int RASocket::authenticate() if (check_password(user, pass) == -1) return -1; - sLog->outInfo(LOG_FILTER_REMOTECOMMAND, "User login: %s", user.c_str()); + TC_LOG_INFO(LOG_FILTER_REMOTECOMMAND, "User login: %s", user.c_str()); return 0; } @@ -302,7 +302,7 @@ int RASocket::subnegotiate() if (n >= 1024) { - sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "RASocket::subnegotiate: allocated buffer 1024 bytes was too small for negotiation packet, size: %u", uint32(n)); + TC_LOG_DEBUG(LOG_FILTER_REMOTECOMMAND, "RASocket::subnegotiate: allocated buffer 1024 bytes was too small for negotiation packet, size: %u", uint32(n)); return -1; } @@ -336,7 +336,7 @@ int RASocket::subnegotiate() uint8 param = buf[++i]; ss << uint32(param); - sLog->outDebug(LOG_FILTER_REMOTECOMMAND, ss.str().c_str()); + TC_LOG_DEBUG(LOG_FILTER_REMOTECOMMAND, ss.str().c_str()); } ++i; } @@ -402,7 +402,7 @@ void RASocket::zprint(void* callbackArg, const char * szText) ACE_Time_Value tv = ACE_Time_Value::zero; if (socket->putq(mb, &tv) == -1) { - sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Failed to enqueue message, queue is full or closed. Error is %s", ACE_OS::strerror(errno)); + TC_LOG_DEBUG(LOG_FILTER_REMOTECOMMAND, "Failed to enqueue message, queue is full or closed. Error is %s", ACE_OS::strerror(errno)); mb->release(); } } @@ -422,7 +422,7 @@ void RASocket::commandFinished(void* callbackArg, bool /*success*/) // hence we don't put timeout, because it shouldn't increase queue size and shouldn't block if (socket->putq(mb->duplicate()) == -1) // getting here is bad, command can't be marked as complete - sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Failed to enqueue command end message. Error is %s", ACE_OS::strerror(errno)); + TC_LOG_DEBUG(LOG_FILTER_REMOTECOMMAND, "Failed to enqueue command end message. Error is %s", ACE_OS::strerror(errno)); mb->release(); |
