From 55ce180f2867700b28921d99f9a0cb9c83330c91 Mon Sep 17 00:00:00 2001 From: Spp Date: Fri, 3 Aug 2012 14:20:18 +0200 Subject: Core/Logging: Add Asyncronous logging with Loggers ("What to log") and Appenders ("Where to log") system. Will allow to select to full log some parts of core while others are not even logged. - Logging System is asyncronous to improve performance. - Each msg and Logger has a Log Type and Log Level assigned. Each msg is assigned the Logger of same Log Type or "root" Logger is selected if there is no Logger configured for the given Log Type - Loggers have a list of Appenders to send the msg to. The Msg in the Logger is not sent to Appenders if the msg LogLevel is lower than Logger LogLevel. - There are three (at the moment) types of Appenders: Console, File or DB (this is WIP, not working ATM). Msg is not written to the resource if msg LogLevel is lower than Appender LogLevel. - Appender and Console Log levels can be changed while server is active with command '.set loglevel (a/l) name level' Explanation of use with Sample config: Appender.Console.Type=1 (1 = Console) Appender.Console.Level=2 (2 = Debug) Appender.Server.Type=2 (2 = File) Appender.Server.Level=3 (3 = Info) Appender.Server.File=Server.log Appender.SQL.Type=2 (2 = File) Appender.SQL.Level=1 (1 = Trace) Appender.SQL.File=sql.log Appenders=Console Server (NOTE: SQL has not been included here... that will make core ignore the config for "SQL" as it's not in this list) Logger.root.Type=0 (0 = Default - if it's not created by config, server will create it with LogLevel = DISABLED) Logger.root.Level=5 (5 = Error) Logger.root.Appenders=Console Logger.SQL.Type=26 (26 = SQL) Logger.SQL.Level=3 (2 = Debug) Logger.SQL.Appenders=Console Server SQL Logger.SomeRandomName.Type=24 (24 = Guild) Logger.SomeRandomName.Level=5 (5 = Error) Loggers=root SQL SomeRandomName * At loading Appender SQL will be ignored, as it's not present on "Appenders" * sLog->outDebug(LOG_FILTER_GUILD, "Some log msg related to Guilds") - Msg is sent to Logger of Type LOG_FILTER_GUILD (24). Logger with name SomeRandomName is found but it's LogLevel = 5 and Msg LogLevel=2... Msg is not logged * sLog->outError(LOG_FILTER_GUILD, "Some error log msg related to Guilds") - Msg is sent to Logger of Type LOG_FILTER_GUILD (24). Logger with name SomeRandomeName is found with proper LogLevel but Logger does not have any Appenders assigned to that logger... Msg is not logged * sLog->outDebug(LOG_FILTER_SQL, "Some msg related to SQLs") - Msg is sent to Logger SQL (matches type), as it matches LogLevel the msg is sent to Appenders Console, Server and SQL - Appender Console has lower Log Level: Msg is logged to Console - Appender Server has higher Log Level: Msg is not logged to file - Appender SQL has lower Log Level: Msg is logged to file sql.log * sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Some msg related to Battelgrounds") - Msg is sent to Logger root (Type 0) as no Logger was found with Type LOG_FILTER_BATTLEGROUND (13). As Logger has higher LogLevel msg is not sent to any appender * sLog->outError(LOG_FILTER_BATTLEGROUND, "Some error msg related to Battelgrounds") - Msg is sent to Logger root (Type 0) as no Logger was found with Type LOG_FILTER_BATTLEGROUND (13). Msg has lower LogLevel and is sent to Appender Console - Appender Console has lower LogLevel: Msg is logged to Console --- src/server/shared/Logging/Appender.cpp | 153 ++++ src/server/shared/Logging/Appender.h | 115 +++ src/server/shared/Logging/AppenderConsole.cpp | 174 ++++ src/server/shared/Logging/AppenderConsole.h | 42 + src/server/shared/Logging/AppenderDB.cpp | 30 + src/server/shared/Logging/AppenderDB.h | 19 + src/server/shared/Logging/AppenderFile.cpp | 54 ++ src/server/shared/Logging/AppenderFile.h | 22 + src/server/shared/Logging/Log.cpp | 1135 ++++++------------------- src/server/shared/Logging/Log.h | 209 +---- src/server/shared/Logging/LogOperation.cpp | 14 + src/server/shared/Logging/LogOperation.h | 24 + src/server/shared/Logging/LogWorker.cpp | 33 + src/server/shared/Logging/LogWorker.h | 30 + src/server/shared/Logging/Logger.cpp | 67 ++ src/server/shared/Logging/Logger.h | 29 + 16 files changed, 1091 insertions(+), 1059 deletions(-) create mode 100644 src/server/shared/Logging/Appender.cpp create mode 100644 src/server/shared/Logging/Appender.h create mode 100644 src/server/shared/Logging/AppenderConsole.cpp create mode 100644 src/server/shared/Logging/AppenderConsole.h create mode 100644 src/server/shared/Logging/AppenderDB.cpp create mode 100644 src/server/shared/Logging/AppenderDB.h create mode 100644 src/server/shared/Logging/AppenderFile.cpp create mode 100644 src/server/shared/Logging/AppenderFile.h create mode 100644 src/server/shared/Logging/LogOperation.cpp create mode 100644 src/server/shared/Logging/LogOperation.h create mode 100644 src/server/shared/Logging/LogWorker.cpp create mode 100644 src/server/shared/Logging/LogWorker.h create mode 100644 src/server/shared/Logging/Logger.cpp create mode 100644 src/server/shared/Logging/Logger.h (limited to 'src/server/shared/Logging') diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp new file mode 100644 index 00000000000..38d58f1ffb5 --- /dev/null +++ b/src/server/shared/Logging/Appender.cpp @@ -0,0 +1,153 @@ +#include "Appender.h" +#include "Common.h" + +std::string LogMessage::getTimeStr(time_t time) +{ + tm* aTm = localtime(&time); + char buf[20]; + snprintf(buf, 20, "%04d-%02d-%02d_%02d:%02d:%02d", aTm->tm_year+1900, aTm->tm_mon+1, aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec); + return std::string(buf); +} + +std::string LogMessage::getTimeStr() +{ + return getTimeStr(mtime); +} + +Appender::Appender(uint8 _id, std::string const& _name, AppenderType _type /* = APPENDER_NONE*/, LogLevel _level /* = LOG_LEVEL_DISABLED */): +id(_id), name(_name), type(_type), level(_level) +{ +} + +Appender::~Appender() +{ +} + +uint8 Appender::getId() const +{ + return id; +} + +std::string const& Appender::getName() const +{ + return name; +} + +AppenderType Appender::getType() const +{ + return type; +} + +LogLevel Appender::getLogLevel() const +{ + return level; +} + +void Appender::setLogLevel(LogLevel _level) +{ + level = _level; +} + +void Appender::write(LogMessage& message) +{ + if (level && level <= message.level) + _write(message); + //else fprintf(stderr, "Appender::write: Appender %s, Level %s. Msg %s Level %s Type %s WRONG LEVEL MASK\n", getName().c_str(), getLogLevelString(level), message.text.c_str(), getLogLevelString(message.level), getLogFilterTypeString(message.type)); // DEBUG - RemoveMe +} + +const char* Appender::getLogLevelString(LogLevel level) +{ + switch (level) + { + case LOG_LEVEL_FATAL: + return "FATAL"; + case LOG_LEVEL_ERROR: + return "ERROR"; + case LOG_LEVEL_WARN: + return "WARN"; + case LOG_LEVEL_INFO: + return "INFO"; + case LOG_LEVEL_DEBUG: + return "DEBUG"; + case LOG_LEVEL_TRACE: + return "TRACE"; + default: + return "DISABLED"; + } +} + +char const* Appender::getLogFilterTypeString(LogFilterType type) +{ + switch (type) + { + case LOG_FILTER_GENERAL: + return "GENERAL"; + case LOG_FILTER_UNITS: + return "UNITS"; + case LOG_FILTER_PETS: + return "PETS"; + case LOG_FILTER_VEHICLES: + return "VEHICLES"; + case LOG_FILTER_TSCR: + return "TSCR"; + case LOG_FILTER_DATABASE_AI: + return "DATABASE_AI"; + case LOG_FILTER_MAPSCRIPTS: + return "MAPSCRIPTS"; + case LOG_FILTER_NETWORKIO: + return "NETWORKIO"; + case LOG_FILTER_SPELLS_AURAS: + return "SPELLS_AURAS"; + case LOG_FILTER_ACHIEVEMENTSYS: + return "ACHIEVEMENTSYS"; + case LOG_FILTER_CONDITIONSYS: + return "CONDITIONSYS"; + case LOG_FILTER_POOLSYS: + return "POOLSYS"; + case LOG_FILTER_AUCTIONHOUSE: + return "AUCTIONHOUSE"; + case LOG_FILTER_BATTLEGROUND: + return "BATTLEGROUND"; + case LOG_FILTER_OUTDOORPVP: + return "OUTDOORPVP"; + case LOG_FILTER_CHATSYS: + return "CHATSYS"; + case LOG_FILTER_LFG: + return "LFG"; + case LOG_FILTER_MAPS: + return "MAPS"; + case LOG_FILTER_PLAYER: + return "PLAYER"; + case LOG_FILTER_PLAYER_LOADING: + return "PLAYER_LOADING"; + case LOG_FILTER_PLAYER_ITEMS: + return "PLAYER_ITEMS"; + case LOG_FILTER_PLAYER_SKILLS: + return "PLAYER_SKILLS"; + case LOG_FILTER_PLAYER_CHATLOG: + return "PLAYER_CHATLOG"; + case LOG_FILTER_LOOT: + return "LOOT"; + case LOG_FILTER_GUILD: + return "GUILD"; + case LOG_FILTER_TRANSPORTS: + return "TRANSPORTS"; + case LOG_FILTER_SQL: + return "SQL"; + case LOG_FILTER_GMCOMMAND: + return "GMCOMMAND"; + case LOG_FILTER_REMOTECOMMAND: + return "REMOTECOMMAND"; + case LOG_FILTER_WARDEN: + return "WARDEN"; + case LOG_FILTER_AUTHSERVER: + return "AUTHSERVER"; + case LOG_FILTER_WORLDSERVER: + return "WORLDSERVER"; + case LOG_FILTER_GAMEEVENTS: + return "GAMEEVENTS"; + default: + break; + } + return "???"; +} diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h new file mode 100644 index 00000000000..992554d59aa --- /dev/null +++ b/src/server/shared/Logging/Appender.h @@ -0,0 +1,115 @@ +#ifndef APPENDER_H +#define APPENDER_H + +#include "Define.h" + +#include +#include + +enum LogFilterType +{ + LOG_FILTER_GENERAL, // This one should only be used inside Log.cpp + LOG_FILTER_UNITS, // Anything related to units that doesn't fit in other categories. ie. creature formations + LOG_FILTER_PETS, + LOG_FILTER_VEHICLES, + LOG_FILTER_TSCR, // C++ AI, instance scripts, etc. + LOG_FILTER_DATABASE_AI, // SmartAI, EventAI, Creature* * AI + LOG_FILTER_MAPSCRIPTS, + LOG_FILTER_NETWORKIO, + LOG_FILTER_SPELLS_AURAS, + LOG_FILTER_ACHIEVEMENTSYS, + LOG_FILTER_CONDITIONSYS, + LOG_FILTER_POOLSYS, + LOG_FILTER_AUCTIONHOUSE, + LOG_FILTER_BATTLEGROUND, + LOG_FILTER_OUTDOORPVP, + LOG_FILTER_CHATSYS, + LOG_FILTER_LFG, + LOG_FILTER_MAPS, + LOG_FILTER_PLAYER, // Any player log that does not fit in other player filters + LOG_FILTER_PLAYER_LOADING, // Debug output from Player::_Load functions + LOG_FILTER_PLAYER_ITEMS, + LOG_FILTER_PLAYER_SKILLS, + LOG_FILTER_PLAYER_CHATLOG, + LOG_FILTER_LOOT, + LOG_FILTER_GUILD, + LOG_FILTER_TRANSPORTS, + LOG_FILTER_SQL, + LOG_FILTER_GMCOMMAND, + LOG_FILTER_REMOTECOMMAND, + LOG_FILTER_WARDEN, + LOG_FILTER_AUTHSERVER, + LOG_FILTER_WORLDSERVER, + LOG_FILTER_GAMEEVENTS, + LOG_FILTER_CALENDAR +}; + +const uint8 MaxLogFilter = uint8(LOG_FILTER_CALENDAR) + 1; + +// Values assigned have their equivalent in enum ACE_Log_Priority +enum LogLevel +{ + LOG_LEVEL_DISABLED = 0, + LOG_LEVEL_TRACE = 1, + LOG_LEVEL_DEBUG = 2, + LOG_LEVEL_INFO = 3, + LOG_LEVEL_WARN = 4, + LOG_LEVEL_ERROR = 5, + LOG_LEVEL_FATAL = 6, +}; + +const uint8 MaxLogLevels = 6; + +enum AppenderType +{ + APPENDER_NONE, + APPENDER_CONSOLE, + APPENDER_FILE, + APPENDER_DB, +}; + +struct LogMessage +{ + LogMessage(LogLevel _level, LogFilterType _type, std::string _text): level(_level), type(_type), text(_text) + { + mtime = time(NULL); + } + + static std::string getTimeStr(time_t time); + std::string getTimeStr(); + + LogLevel level; + LogFilterType type; + std::string text; + uint32 param1; + time_t mtime; +}; + +class Appender +{ + public: + Appender(uint8 _id, std::string const& name, AppenderType type = APPENDER_NONE, LogLevel level = LOG_LEVEL_DISABLED); + virtual ~Appender(); + + uint8 getId() const; + std::string const& getName() const; + AppenderType getType() const; + LogLevel getLogLevel() const; + + void setLogLevel(LogLevel); + void write(LogMessage& message); + static const char* getLogLevelString(LogLevel level); + static const char* getLogFilterTypeString(LogFilterType type); + + private: + virtual void _write(LogMessage& /*message*/) {}; + + uint8 id; + std::string name; + AppenderType type; + LogLevel level; +}; + +typedef std::map AppenderMap; + +#endif diff --git a/src/server/shared/Logging/AppenderConsole.cpp b/src/server/shared/Logging/AppenderConsole.cpp new file mode 100644 index 00000000000..ad81a883bfa --- /dev/null +++ b/src/server/shared/Logging/AppenderConsole.cpp @@ -0,0 +1,174 @@ +#include "AppenderConsole.h" +#include "Config.h" +#include "Util.h" + +#include + +AppenderConsole::AppenderConsole(uint8 id, std::string const& name, LogLevel level): +Appender(id, name, APPENDER_CONSOLE, level), _colored(false), _colors() +{ +} + +void AppenderConsole::InitColors(std::string const& str) +{ + if (str.empty()) + { + _colored = false; + return; + } + + int color[MaxLogLevels]; + + std::istringstream ss(str); + + for (uint8 i = 0; i < MaxLogLevels; ++i) + { + ss >> color[i]; + + if (!ss) + return; + + if (color[i] < 0 || color[i] >= MaxColors) + return; + } + + for (uint8 i = 0; i < MaxLogLevels; ++i) + _colors[i] = ColorTypes(color[i]); + + _colored = true; +} + +void AppenderConsole::SetColor(bool stdout_stream, ColorTypes color) +{ + #if PLATFORM == PLATFORWINDOWS + static WORD WinColorFG[MaxColors] = + { + 0, // BLACK + FOREGROUND_RED, // RED + FOREGROUND_GREEN, // GREEN + FOREGROUND_RED | FOREGROUND_GREEN, // BROWN + FOREGROUND_BLUE, // BLUE + FOREGROUND_RED | FOREGROUND_BLUE, // MAGENTA + FOREGROUND_GREEN | FOREGROUND_BLUE, // CYAN + FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE, // WHITE + // YELLOW + FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY, + // RED_BOLD + FOREGROUND_RED | FOREGROUND_INTENSITY, + // GREEN_BOLD + FOREGROUND_GREEN | FOREGROUND_INTENSITY, + FOREGROUND_BLUE | FOREGROUND_INTENSITY, // BLUE_BOLD + // MAGENTA_BOLD + FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY, + // CYAN_BOLD + FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY, + // WHITE_BOLD + FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY + }; + + HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE); + SetConsoleTextAttribute(hConsole, WinColorFG[color]); + #else + enum ANSITextAttr + { + TA_NORMAL = 0, + TA_BOLD = 1, + TA_BLINK = 5, + TA_REVERSE = 7 + }; + + enum ANSIFgTextAttr + { + FG_BLACK = 30, + FG_RED, + FG_GREEN, + FG_BROWN, + FG_BLUE, + FG_MAGENTA, + FG_CYAN, + FG_WHITE, + FG_YELLOW + }; + + enum ANSIBgTextAttr + { + BG_BLACK = 40, + BG_RED, + BG_GREEN, + BG_BROWN, + BG_BLUE, + BG_MAGENTA, + BG_CYAN, + BG_WHITE + }; + + static uint8 UnixColorFG[MaxColors] = + { + FG_BLACK, // BLACK + FG_RED, // RED + FG_GREEN, // GREEN + FG_BROWN, // BROWN + FG_BLUE, // BLUE + FG_MAGENTA, // MAGENTA + FG_CYAN, // CYAN + FG_WHITE, // WHITE + FG_YELLOW, // YELLOW + FG_RED, // LRED + FG_GREEN, // LGREEN + FG_BLUE, // LBLUE + FG_MAGENTA, // LMAGENTA + FG_CYAN, // LCYAN + FG_WHITE // LWHITE + }; + + fprintf((stdout_stream? stdout : stderr), "\x1b[%d%sm", UnixColorFG[color], (color >= YELLOW && color < MaxColors ? ";1" : "")); + #endif +} + +void AppenderConsole::ResetColor(bool stdout_stream) +{ + #if PLATFORM == PLATFORWINDOWS + HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE); + SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED); + #else + fprintf((stdout_stream ? stdout : stderr), "\x1b[0m"); + #endif +} + +void AppenderConsole::_write(LogMessage& message) +{ + bool stdout_stream = message.level == LOG_LEVEL_ERROR || message.level == LOG_LEVEL_FATAL; + + if (_colored) + { + uint8 index; + switch (message.level) + { + case LOG_LEVEL_TRACE: + index = 5; + break; + case LOG_LEVEL_DEBUG: + index = 4; + break; + case LOG_LEVEL_INFO: + index = 3; + break; + case LOG_LEVEL_WARN: + index = 2; + break; + case LOG_LEVEL_FATAL: + index = 0; + break; + case LOG_LEVEL_ERROR: // No break on purpose + default: + index = 1; + break; + } + + SetColor(stdout_stream, _colors[index]); + utf8printf(stdout_stream ? stdout : stderr, "%s %-5s [%-15s] %s", message.getTimeStr().c_str(), Appender::getLogLevelString(message.level), Appender::getLogFilterTypeString(message.type), message.text.c_str()); + ResetColor(stdout_stream); + } + else + utf8printf(stdout_stream ? stdout : stderr, "%s %-5s [%-15s] %s", message.getTimeStr().c_str(), Appender::getLogLevelString(message.level), Appender::getLogFilterTypeString(message.type), message.text.c_str()); +} diff --git a/src/server/shared/Logging/AppenderConsole.h b/src/server/shared/Logging/AppenderConsole.h new file mode 100644 index 00000000000..a9f46cf9c4a --- /dev/null +++ b/src/server/shared/Logging/AppenderConsole.h @@ -0,0 +1,42 @@ +#ifndef APPENDERCONSOLE_H +#define APPENDERCONSOLE_H + +#include "Appender.h" +#include + +enum ColorTypes +{ + BLACK, + RED, + GREEN, + BROWN, + BLUE, + MAGENTA, + CYAN, + GREY, + YELLOW, + LRED, + LGREEN, + LBLUE, + LMAGENTA, + LCYAN, + WHITE +}; + +const uint8 MaxColors = uint8(WHITE) + 1; + +class AppenderConsole: public Appender +{ + public: + AppenderConsole(uint8 _id, std::string const& name, LogLevel level); + void InitColors(const std::string& init_str); + + private: + void SetColor(bool stdout_stream, ColorTypes color); + void ResetColor(bool stdout_stream); + void _write(LogMessage& message); + bool _colored; + ColorTypes _colors[MaxLogLevels]; +}; + +#endif diff --git a/src/server/shared/Logging/AppenderDB.cpp b/src/server/shared/Logging/AppenderDB.cpp new file mode 100644 index 00000000000..6f3737adf4d --- /dev/null +++ b/src/server/shared/Logging/AppenderDB.cpp @@ -0,0 +1,30 @@ +#include "AppenderDB.h" + +/* FIXME +#include "DatabaseWorkerPool.h" +#include "Implementation/LoginDatabase.h" // For logging +extern DatabaseWorkerPool LoginDatabase; +*/ + +AppenderDB::AppenderDB(uint8 id, std::string const& name, LogLevel level, uint8 realmId): +Appender(id, name, APPENDER_DB, level), realm(realmId), enable(false) +{ +} + +AppenderDB::~AppenderDB() +{ +} + +void AppenderDB::_write(LogMessage& /*message*/) +{ +/* FIXME + if (enable) + LoginDatabase.PExecute("INSERT INTO logs (time, realm, type, severity, string) " + "VALUES (" UI64FMTD ", %u, %u, '%s');", message.mtime, realm, message.type, message.level, message.text.c_str()); +*/ +} + +void AppenderDB::setEnable(bool _enable) +{ + enable = _enable; +} diff --git a/src/server/shared/Logging/AppenderDB.h b/src/server/shared/Logging/AppenderDB.h new file mode 100644 index 00000000000..ca15fc1a1d5 --- /dev/null +++ b/src/server/shared/Logging/AppenderDB.h @@ -0,0 +1,19 @@ +#ifndef APPENDERDB_H +#define APPENDERDB_H + +#include "Appender.h" + +class AppenderDB: public Appender +{ + public: + AppenderDB(uint8 _id, std::string const& _name, LogLevel level, uint8 realmId); + ~AppenderDB(); + void setEnable(bool enable); + + private: + uint8 realm; + bool enable; + void _write(LogMessage& message); +}; + +#endif diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp new file mode 100644 index 00000000000..30c1f271c96 --- /dev/null +++ b/src/server/shared/Logging/AppenderFile.cpp @@ -0,0 +1,54 @@ +#include "AppenderFile.h" +#include "Common.h" + +AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _mode, bool _backup) + : Appender(id, name, APPENDER_FILE, level) + , filename(_filename) + , mode(_mode) + , backup(_backup) +{ + dynamicName = std::string::npos != filename.find("%u"); + if (!dynamicName) + logfile = OpenFile(_filename, _mode, _backup); +} + +AppenderFile::~AppenderFile() +{ + if (logfile) + { + fclose(logfile); + logfile = NULL; + } +} + +void AppenderFile::_write(LogMessage& message) +{ + if (dynamicName) + { + char namebuf[TRINITY_PATH_MAX]; + snprintf(namebuf, TRINITY_PATH_MAX, filename.c_str(), message.param1); + logfile = OpenFile(namebuf, mode, backup); + } + + if (logfile) + { + fprintf(logfile, "%s %-5s [%-15s] %s", message.getTimeStr().c_str(), Appender::getLogLevelString(message.level), Appender::getLogFilterTypeString(message.type), message.text.c_str()); + + fflush(logfile); + + if (dynamicName) + fclose(logfile); + } +} + +FILE* AppenderFile::OpenFile(std::string const &filename, std::string const &mode, bool backup) +{ + if (mode == "w" && backup) + { + std::string newName(filename); + newName.push_back('.'); + newName.append(LogMessage::getTimeStr(time(NULL))); + rename(filename.c_str(), newName.c_str()); // no error handling... if we couldn't make a backup, just ignore + } + return fopen(filename.c_str(), mode.c_str()); +} diff --git a/src/server/shared/Logging/AppenderFile.h b/src/server/shared/Logging/AppenderFile.h new file mode 100644 index 00000000000..a01ea947334 --- /dev/null +++ b/src/server/shared/Logging/AppenderFile.h @@ -0,0 +1,22 @@ +#ifndef APPENDERFILE_H +#define APPENDERFILE_H + +#include "Appender.h" + +class AppenderFile: public Appender +{ + public: + AppenderFile(uint8 _id, std::string const& _name, LogLevel level, const char* filename, const char* mode, bool backup); + ~AppenderFile(); + FILE* OpenFile(std::string const& _name, std::string const& _mode, bool _backup); + + private: + void _write(LogMessage& message); + FILE* logfile; + std::string filename; + std::string mode; + bool dynamicName; + bool backup; +}; + +#endif diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 79eab053d08..17c6df44125 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2008-2012 TrinityCore - * Copyright (C) 2005-2009 MaNGOS + * Copyright (C) 2005-2008 MaNGOS * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -16,343 +16,246 @@ * with this program. If not, see . */ -#include "Common.h" #include "Log.h" -#include "Configuration/Config.h" -#include "Util.h" +#include "Common.h" +#include "Config.h" -#include "Implementation/LoginDatabase.h" // For logging -extern LoginDatabaseWorkerPool LoginDatabase; +#include "AppenderConsole.h" +#include "AppenderFile.h" +#include "AppenderDB.h" +#include "LogOperation.h" -#include -#include +#include +#include +#include -Log::Log() : - raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL), - dberLogfile(NULL), chatLogfile(NULL), arenaLogFile(NULL), sqlLogFile(NULL), sqlDevLogFile(NULL), wardenLogFile(NULL), - m_gmlog_per_account(false), m_enableLogDBLater(false), - m_enableLogDB(false), m_colored(false) +Log::Log() { - Initialize(); + SetRealmID(0); + AppenderId = 0; + /// Common log files data + m_logsDir = ConfigMgr::GetStringDefault("LogsDir", ""); + if (!m_logsDir.empty()) + if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\')) + m_logsDir.push_back('/'); + + m_logsTimestamp = "_" + GetTimestampStr(); + + ReadAppendersFromConfig(); + ReadLoggersFromConfig(); + worker = new LogWorker(); } Log::~Log() { - if (logfile != NULL) - fclose(logfile); - logfile = NULL; - - if (gmLogfile != NULL) - fclose(gmLogfile); - gmLogfile = NULL; - - if (charLogfile != NULL) - fclose(charLogfile); - charLogfile = NULL; - - if (dberLogfile != NULL) - fclose(dberLogfile); - dberLogfile = NULL; - - if (raLogfile != NULL) - fclose(raLogfile); - raLogfile = NULL; - - if (chatLogfile != NULL) - fclose(chatLogfile); - chatLogfile = NULL; - - if (arenaLogFile != NULL) - fclose(arenaLogFile); - arenaLogFile = NULL; - - if (sqlLogFile != NULL) - fclose(sqlLogFile); - sqlLogFile = NULL; - - if (sqlDevLogFile != NULL) - fclose(sqlDevLogFile); - sqlDevLogFile = NULL; - - if (wardenLogFile != NULL) - fclose(wardenLogFile); - wardenLogFile = NULL; + Close(); } -void Log::SetLogLevel(char *Level) +uint8 Log::NextAppenderId() { - int32 NewLevel = atoi((char*)Level); - if (NewLevel < 0) - NewLevel = 0; - m_logLevel = NewLevel; - - outString("LogLevel is %u", m_logLevel); + return AppenderId++; } -void Log::SetLogFileLevel(char *Level) +int32 GetConfigIntDefault(std::string base, const char* name, int32 value) { - int32 NewLevel = atoi((char*)Level); - if (NewLevel < 0) - NewLevel = 0; - m_logFileLevel = NewLevel; + base.append(name); + return ConfigMgr::GetIntDefault(base.c_str(), value); +} - outString("LogFileLevel is %u", m_logFileLevel); +std::string GetConfigStringDefault(std::string base, const char* name, const char* value) +{ + base.append(name); + return ConfigMgr::GetStringDefault(base.c_str(), value); } -void Log::SetDBLogLevel(char *Level) +// Returns default logger if the requested logger is not found +Logger* Log::GetLoggerByType(LogFilterType filter) { - int32 NewLevel = atoi((char*)Level); - if (NewLevel < 0) - NewLevel = 0; - m_dbLogLevel = NewLevel; + LoggerMap::iterator it = loggers.begin(); + while (it != loggers.end() && it->second.getType() != filter) + ++it; - outString("DBLogLevel is %u", m_dbLogLevel); + return it == loggers.end() ? &(loggers[0]) : &(it->second); } -void Log::Initialize() +Appender* Log::GetAppenderByName(std::string const& name) { - /// Check whether we'll log GM commands/RA events/character outputs/chat stuffs - m_dbChar = ConfigMgr::GetBoolDefault("LogDB.Char", false); - m_dbRA = ConfigMgr::GetBoolDefault("LogDB.RA", false); - m_dbGM = ConfigMgr::GetBoolDefault("LogDB.GM", false); - m_dbChat = ConfigMgr::GetBoolDefault("LogDB.Chat", false); + AppenderMap::iterator it = appenders.begin(); + while (it != appenders.end() && it->second && it->second->getName() != name) + ++it; - /// Realm must be 0 by default - SetRealmID(0); + return it == appenders.end() ? NULL : it->second; +} - /// Common log files data - m_logsDir = ConfigMgr::GetStringDefault("LogsDir", ""); - if (!m_logsDir.empty()) - if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\')) - m_logsDir.push_back('/'); +void Log::CreateAppenderFromConfig(const char* name) +{ + if (!name || *name == '\0') + return; - m_logsTimestamp = "_" + GetTimestampStr(); + std::string base = "Appender."; + base.append(name); + base.push_back('.'); - /// Open specific log files - logfile = openLogFile("LogFile", "LogTimestamp", "w"); - InitColors(ConfigMgr::GetStringDefault("LogColors", "")); + LogLevel level = LogLevel(GetConfigIntDefault(base, "Level", 0)); + AppenderType type = AppenderType(GetConfigIntDefault(base, "Type", 0)); - m_gmlog_per_account = ConfigMgr::GetBoolDefault("GmLogPerAccount", false); - if (!m_gmlog_per_account) - gmLogfile = openLogFile("GMLogFile", "GmLogTimestamp", "a"); - else + switch(type) { - // GM log settings for per account case - m_gmlog_filename_format = ConfigMgr::GetStringDefault("GMLogFile", ""); - if (!m_gmlog_filename_format.empty()) + case APPENDER_CONSOLE: { - bool m_gmlog_timestamp = ConfigMgr::GetBoolDefault("GmLogTimestamp", false); + AppenderConsole* appender = new AppenderConsole(NextAppenderId(), name, level); + appenders[appender->getId()] = appender; - size_t dot_pos = m_gmlog_filename_format.find_last_of('.'); - if (dot_pos!=m_gmlog_filename_format.npos) - { - if (m_gmlog_timestamp) - m_gmlog_filename_format.insert(dot_pos, m_logsTimestamp); + appender->InitColors(GetConfigStringDefault(base, "Colors", "")); + //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type CONSOLE, Mask %u\n", appender->getName().c_str(), appender->getId(), appender->getLogLevel()); // DEBUG - RemoveMe + break; + } + case APPENDER_FILE: + { + std::string filename = GetConfigStringDefault(base, "File", ""); + std::string mode = GetConfigStringDefault(base, "Mode", "a"); + std::string timestamp = GetConfigStringDefault(base, "Timestamp", ""); + bool backup = GetConfigIntDefault(base, "Backup", 0); - m_gmlog_filename_format.insert(dot_pos, "_#%u"); - } - else + if (!timestamp.empty()) { - m_gmlog_filename_format += "_#%u"; - - if (m_gmlog_timestamp) - m_gmlog_filename_format += m_logsTimestamp; + size_t dot_pos = filename.find_last_of("."); + if (dot_pos != filename.npos) + filename.insert(dot_pos, m_logsTimestamp); + else + filename += m_logsTimestamp; } - m_gmlog_filename_format = m_logsDir + m_gmlog_filename_format; + uint8 id = NextAppenderId(); + appenders[id] = new AppenderFile(id, name, level, filename.c_str(), mode.c_str(), backup); + //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type FILE, Mask %u, File %s, Mode %s\n", name, id, level, filename.c_str(), mode.c_str()); // DEBUG - RemoveMe + break; } + case APPENDER_DB: // TODO Set realm! + { + uint8 id = NextAppenderId(); + appenders[id] = new AppenderDB(id, name, level, realm); + break; + } + default: + break; } +} + +void Log::CreateLoggerFromConfig(const char* name) +{ + if (!name || *name == '\0') + return; + + std::string base = "Logger."; + base.append(name); + base.push_back('.'); + + LogLevel level = LogLevel(GetConfigIntDefault(base, "Level", 0)); + int32 type = GetConfigIntDefault(base, "Type", -1); - charLogfile = openLogFile("CharLogFile", "CharLogTimestamp", "a"); - dberLogfile = openLogFile("DBErrorLogFile", NULL, "a"); - raLogfile = openLogFile("RaLogFile", NULL, "a"); - chatLogfile = openLogFile("ChatLogFile", "ChatLogTimestamp", "a"); - arenaLogFile = openLogFile("ArenaLogFile", NULL, "a"); - sqlLogFile = openLogFile("SQLDriverLogFile", NULL, "a"); - sqlDevLogFile = openLogFile("SQLDeveloperLogFile", NULL, "a"); - wardenLogFile = openLogFile("Warden.LogFile",NULL,"a"); - - // Main log file settings - m_logLevel = ConfigMgr::GetIntDefault("LogLevel", LOGL_NORMAL); - m_logFileLevel = ConfigMgr::GetIntDefault("LogFileLevel", LOGL_NORMAL); - m_dbLogLevel = ConfigMgr::GetIntDefault("DBLogLevel", LOGL_NORMAL); - m_sqlDriverQueryLogging = ConfigMgr::GetBoolDefault("SQLDriverQueryLogging", false); - - m_DebugLogMask = DebugLogFilters(ConfigMgr::GetIntDefault("DebugLogMask", LOG_FILTER_NONE)); - - // Char log settings - m_charLog_Dump = ConfigMgr::GetBoolDefault("CharLogDump", false); - m_charLog_Dump_Separate = ConfigMgr::GetBoolDefault("CharLogDump.Separate", false); - if (m_charLog_Dump_Separate) + if (type < 0) { - m_dumpsDir = ConfigMgr::GetStringDefault("CharLogDump.SeparateDir", ""); - if (!m_dumpsDir.empty()) - if ((m_dumpsDir.at(m_dumpsDir.length() - 1) != '/') && (m_dumpsDir.at(m_dumpsDir.length() - 1) != '\\')) - m_dumpsDir.push_back('/'); + fprintf(stderr, "Log::CreateLoggerFromConfig: Missing entry %sType in config. Logger ignored\n", name); + return; } -} -void Log::ReloadConfig() -{ - m_logLevel = ConfigMgr::GetIntDefault("LogLevel", LOGL_NORMAL); - m_logFileLevel = ConfigMgr::GetIntDefault("LogFileLevel", LOGL_NORMAL); - m_dbLogLevel = ConfigMgr::GetIntDefault("DBLogLevel", LOGL_NORMAL); + Logger& logger = loggers[type]; - m_DebugLogMask = DebugLogFilters(ConfigMgr::GetIntDefault("DebugLogMask", LOG_FILTER_NONE)); -} + if (!logger.getName().empty()) + fprintf(stderr, "Error while configuring Logger %s. Replacing (name: %s, Type: %u, Level: %u) with (name: %s, Type: %u, Level: %u)\n", + name, logger.getName().c_str(), logger.getType(), logger.getLogLevel(), name, type, level); -FILE* Log::openLogFile(char const* configFileName, char const* configTimeStampFlag, char const* mode) -{ - std::string logfn=ConfigMgr::GetStringDefault(configFileName, ""); - if (logfn.empty()) - return NULL; + logger.Create(name, LogFilterType(type), level); + //fprintf(stdout, "Log::CreateLoggerFromConfig: Created Logger %s, Type %u, mask %u\n", name, LogFilterType(type), level); // DEBUG - RemoveMe - if (configTimeStampFlag && ConfigMgr::GetBoolDefault(configTimeStampFlag, false)) + std::istringstream ss(GetConfigStringDefault(base, "Appenders", "")); + std::string str; + + ss >> str; + while (ss) { - size_t dot_pos = logfn.find_last_of("."); - if (dot_pos!=logfn.npos) - logfn.insert(dot_pos, m_logsTimestamp); + if (Appender* appender = GetAppenderByName(str)) + { + logger.addAppender(appender->getId(), appender); + //fprintf(stdout, "Log::CreateLoggerFromConfig: Added Appender %s to Logger %s\n", appender->getName().c_str(), name); // DEBUG - RemoveMe + } else - logfn += m_logsTimestamp; + fprintf(stderr, "Error while configuring Appender %s in Logger %s. Appender does not exist", str.c_str(), name); + ss >> str; } - - return fopen((m_logsDir+logfn).c_str(), mode); } -FILE* Log::openGmlogPerAccount(uint32 account) +void Log::ReadAppendersFromConfig() { - if (m_gmlog_filename_format.empty()) - return NULL; + std::istringstream ss(ConfigMgr::GetStringDefault("Appenders", "")); + std::string name; - char namebuf[TRINITY_PATH_MAX]; - snprintf(namebuf, TRINITY_PATH_MAX, m_gmlog_filename_format.c_str(), account); - return fopen(namebuf, "a"); + do + { + ss >> name; + CreateAppenderFromConfig(name.c_str()); + name = ""; + } + while (ss); } -void Log::outTimestamp(FILE* file) +void Log::ReadLoggersFromConfig() { - time_t t = time(NULL); - tm* aTm = localtime(&t); - // YYYY year - // MM month (2 digits 01-12) - // DD day (2 digits 01-31) - // HH hour (2 digits 00-23) - // MM minutes (2 digits 00-59) - // SS seconds (2 digits 00-59) - fprintf(file, "%-4d-%02d-%02d %02d:%02d:%02d ", aTm->tm_year+1900, aTm->tm_mon+1, aTm->tm_mday, aTm->tm_hour, aTm->tm_min, aTm->tm_sec); -} + std::istringstream ss(ConfigMgr::GetStringDefault("Loggers", "")); + std::string name; -void Log::InitColors(const std::string& str) -{ - if (str.empty()) + do { - m_colored = false; - return; + ss >> name; + CreateLoggerFromConfig(name.c_str()); + name = ""; } + while (ss); - int color[4]; - - std::istringstream ss(str); + LoggerMap::const_iterator it = loggers.begin(); - for (uint8 i = 0; i < LogLevels; ++i) - { - ss >> color[i]; + while (it != loggers.end() && it->first) + ++it; - if (!ss) - return; - - if (color[i] < 0 || color[i] >= Colors) - return; - } + // root logger must exist. Marking as disabled as its not configured + if (it == loggers.end()) + loggers[0].Create("root", LOG_FILTER_GENERAL, LOG_LEVEL_DISABLED); +} - for (uint8 i = 0; i < LogLevels; ++i) - m_colors[i] = ColorTypes(color[i]); +void Log::EnableDBAppenders() +{ + for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it) + if (it->second && it->second->getType() == APPENDER_DB) + ((AppenderDB *)it->second)->setEnable(true); - m_colored = true; } -void Log::SetColor(bool stdout_stream, ColorTypes color) +void Log::log(LogFilterType filter, LogLevel level, char const* str, ...) { - #if PLATFORM == PLATFORM_WINDOWS - static WORD WinColorFG[Colors] = - { - 0, // BLACK - FOREGROUND_RED, // RED - FOREGROUND_GREEN, // GREEN - FOREGROUND_RED | FOREGROUND_GREEN, // BROWN - FOREGROUND_BLUE, // BLUE - FOREGROUND_RED | FOREGROUND_BLUE, // MAGENTA - FOREGROUND_GREEN | FOREGROUND_BLUE, // CYAN - FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE, // WHITE - // YELLOW - FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY, - // RED_BOLD - FOREGROUND_RED | FOREGROUND_INTENSITY, - // GREEN_BOLD - FOREGROUND_GREEN | FOREGROUND_INTENSITY, - FOREGROUND_BLUE | FOREGROUND_INTENSITY, // BLUE_BOLD - // MAGENTA_BOLD - FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY, - // CYAN_BOLD - FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY, - // WHITE_BOLD - FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY - }; - - HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE ); - SetConsoleTextAttribute(hConsole, WinColorFG[color]); - #else - enum ANSITextAttr - { - TA_NORMAL=0, - TA_BOLD=1, - TA_BLINK=5, - TA_REVERSE=7 - }; + if (!str || !ShouldLog(filter, level)) + return; - enum ANSIFgTextAttr - { - FG_BLACK=30, FG_RED, FG_GREEN, FG_BROWN, FG_BLUE, - FG_MAGENTA, FG_CYAN, FG_WHITE, FG_YELLOW - }; + va_list ap; + va_start(ap, str); - enum ANSIBgTextAttr - { - BG_BLACK=40, BG_RED, BG_GREEN, BG_BROWN, BG_BLUE, - BG_MAGENTA, BG_CYAN, BG_WHITE - }; + vlog(filter, level, str, ap); - static uint8 UnixColorFG[Colors] = - { - FG_BLACK, // BLACK - FG_RED, // RED - FG_GREEN, // GREEN - FG_BROWN, // BROWN - FG_BLUE, // BLUE - FG_MAGENTA, // MAGENTA - FG_CYAN, // CYAN - FG_WHITE, // WHITE - FG_YELLOW, // YELLOW - FG_RED, // LRED - FG_GREEN, // LGREEN - FG_BLUE, // LBLUE - FG_MAGENTA, // LMAGENTA - FG_CYAN, // LCYAN - FG_WHITE // LWHITE - }; - - fprintf((stdout_stream? stdout : stderr), "\x1b[%d%sm", UnixColorFG[color], (color >= YELLOW && color < Colors ? ";1" : "")); - #endif + va_end(ap); +} + +void Log::vlog(LogFilterType filter, LogLevel level, char const* str, va_list argptr) +{ + char text[MAX_QUERY_LEN]; + vsnprintf(text, MAX_QUERY_LEN, str, argptr); + write(new LogMessage(level, filter, text)); } -void Log::ResetColor(bool stdout_stream) +void Log::write(LogMessage* msg) { - #if PLATFORM == PLATFORM_WINDOWS - HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE ); - SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED ); - #else - fprintf(( stdout_stream ? stdout : stderr ), "\x1b[0m"); - #endif + msg->text.append("\n"); + Logger* logger = GetLoggerByType(msg->type); + worker->enqueue(new LogOperation(logger, msg)); } std::string Log::GetTimestampStr() @@ -370,710 +273,160 @@ std::string Log::GetTimestampStr() return std::string(buf); } -void Log::outDB(LogTypes type, const char * str) +bool Log::SetLogLevel(std::string const& name, const char* newLevelc, bool isLogger /* = true */) { - if (!str || type >= MAX_LOG_TYPES) - return; + LogLevel newLevel = LogLevel(atoi(newLevelc)); + if (newLevel < 0) + return false; - std::string logStr(str); - if (logStr.empty()) - return; - - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_LOG); - - stmt->setInt32(0, realm); - stmt->setUInt8(1, uint8(type)); - stmt->setString(2, logStr); - - LoginDatabase.Execute(stmt); -} - -void Log::outString(const char * str, ...) -{ - if (!str) - return; - - if (m_enableLogDB) + if (isLogger) { - // we don't want empty strings in the DB - std::string s(str); - if (s.empty() || s == " ") - return; - - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_STRING, nnew_str); - va_end(ap2); - } + LoggerMap::iterator it = loggers.begin(); + while (it != loggers.end() && it->second.getName() != name) + ++it; - if (m_colored) - SetColor(true, m_colors[LOGL_NORMAL]); + if (it == loggers.end()) + return false; - va_list ap; - - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - if (m_colored) - ResetColor(true); - - printf("\n"); - if (logfile) - { - outTimestamp(logfile); - va_start(ap, str); - vfprintf(logfile, str, ap); - fprintf(logfile, "\n"); - va_end(ap); - - fflush(logfile); + it->second.setLogLevel(newLevel); } - fflush(stdout); -} - -void Log::outString() -{ - printf("\n"); - if (logfile) - { - outTimestamp(logfile); - fprintf(logfile, "\n"); - fflush(logfile); - } - fflush(stdout); -} - -void Log::outCrash(const char * err, ...) -{ - if (!err) - return; - - if (m_enableLogDB) - { - va_list ap2; - va_start(ap2, err); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, err, ap2); - outDB(LOG_TYPE_CRASH, nnew_str); - va_end(ap2); - } - - if (m_colored) - SetColor(false, LRED); - - va_list ap; - - va_start(ap, err); - vutf8printf(stderr, err, &ap); - va_end(ap); - - if (m_colored) - ResetColor(false); - - fprintf(stderr, "\n"); - if (logfile) + else { - outTimestamp(logfile); - fprintf(logfile, "CRASH ALERT: "); - - va_start(ap, err); - vfprintf(logfile, err, ap); - va_end(ap); + Appender* appender = GetAppenderByName(name); + if (!appender) + return false; - fprintf(logfile, "\n"); - fflush(logfile); + appender->setLogLevel(newLevel); } - fflush(stderr); + return true; } -void Log::outError(const char * err, ...) +bool Log::ShouldLog(LogFilterType type, LogLevel level) const { - if (!err) - return; - - if (m_enableLogDB) - { - va_list ap2; - va_start(ap2, err); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, err, ap2); - outDB(LOG_TYPE_ERROR, nnew_str); - va_end(ap2); - } - - if (m_colored) - SetColor(false, LRED); - - va_list ap; - - va_start(ap, err); - vutf8printf(stderr, err, &ap); - va_end(ap); + LoggerMap::const_iterator it = loggers.begin(); + while (it != loggers.end() && it->second.getType() != type) + ++it; - if (m_colored) - ResetColor(false); - - fprintf( stderr, "\n"); - if (logfile) + if (it != loggers.end()) { - outTimestamp(logfile); - fprintf(logfile, "ERROR: "); - - va_start(ap, err); - vfprintf(logfile, err, ap); - va_end(ap); - - fprintf(logfile, "\n"); - fflush(logfile); + LogLevel loggerLevel = it->second.getLogLevel(); + return loggerLevel && loggerLevel <= level; } - fflush(stderr); -} -void Log::outArena(const char * str, ...) -{ - if (!str) - return; + if (type != LOG_FILTER_GENERAL) + return ShouldLog(LOG_FILTER_GENERAL, level); - if (arenaLogFile) - { - va_list ap; - outTimestamp(arenaLogFile); - va_start(ap, str); - vfprintf(arenaLogFile, str, ap); - fprintf(arenaLogFile, "\n"); - va_end(ap); - fflush(arenaLogFile); - } + return false; } -void Log::outSQLDriver(const char* str, ...) +void Log::outTrace(LogFilterType filter, const char * str, ...) { - if (!str) + if (!str || !ShouldLog(filter, LOG_LEVEL_TRACE)) return; va_list ap; va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - printf("\n"); - - if (sqlLogFile) - { - outTimestamp(sqlLogFile); - - va_list apSQL; - va_start(apSQL, str); - vfprintf(sqlLogFile, str, apSQL); - va_end(apSQL); - - fprintf(sqlLogFile, "\n"); - fflush(sqlLogFile); - } - - fflush(stdout); -} - -void Log::outErrorDb(const char * err, ...) -{ - if (!err) - return; - - if (m_colored) - SetColor(false, LRED); - va_list ap; + vlog(filter, LOG_LEVEL_TRACE, str, ap); - va_start(ap, err); - vutf8printf(stderr, err, &ap); va_end(ap); - - if (m_colored) - ResetColor(false); - - fprintf( stderr, "\n" ); - - if (logfile) - { - outTimestamp(logfile); - fprintf(logfile, "ERROR: " ); - - va_start(ap, err); - vfprintf(logfile, err, ap); - va_end(ap); - - fprintf(logfile, "\n" ); - fflush(logfile); - } - - if (dberLogfile) - { - outTimestamp(dberLogfile); - va_start(ap, err); - vfprintf(dberLogfile, err, ap); - va_end(ap); - - fprintf(dberLogfile, "\n" ); - fflush(dberLogfile); - } - fflush(stderr); } -void Log::outBasic(const char * str, ...) +void Log::outDebug(LogFilterType filter, const char * str, ...) { - if (!str) + if (!str || !ShouldLog(filter, LOG_LEVEL_DEBUG)) return; - if (m_enableLogDB && m_dbLogLevel > LOGL_NORMAL) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_BASIC, nnew_str); - va_end(ap2); - } - - if (m_logLevel > LOGL_NORMAL) - { - if (m_colored) - SetColor(true, m_colors[LOGL_BASIC]); - - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - if (m_colored) - ResetColor(true); - - printf("\n"); - - if (logfile) - { - outTimestamp(logfile); - va_list ap2; - va_start(ap2, str); - vfprintf(logfile, str, ap2); - fprintf(logfile, "\n" ); - va_end(ap2); - fflush(logfile); - } - } - fflush(stdout); -} - -void Log::outDetail(const char * str, ...) -{ - if (!str) - return; - - if (m_enableLogDB && m_dbLogLevel > LOGL_BASIC) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_DETAIL, nnew_str); - va_end(ap2); - } - - if (m_logLevel > LOGL_BASIC) - { - if (m_colored) - SetColor(true, m_colors[LOGL_DETAIL]); - - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - if (m_colored) - ResetColor(true); + va_list ap; + va_start(ap, str); - printf("\n"); + vlog(filter, LOG_LEVEL_DEBUG, str, ap); - if (logfile) - { - outTimestamp(logfile); - va_list ap2; - va_start(ap2, str); - vfprintf(logfile, str, ap2); - va_end(ap2); - - fprintf(logfile, "\n"); - fflush(logfile); - } - } - - fflush(stdout); + va_end(ap); } -void Log::outDebugInLine(const char * str, ...) +void Log::outInfo(LogFilterType filter, const char * str, ...) { - if (!str) + if (!str || !ShouldLog(filter, LOG_LEVEL_INFO)) return; - if (m_logLevel > LOGL_DETAIL) - { - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); + va_list ap; + va_start(ap, str); - //if (m_colored) - // ResetColor(true); + vlog(filter, LOG_LEVEL_INFO, str, ap); - if (logfile) - { - va_list ap2; - va_start(ap2, str); - vfprintf(logfile, str, ap2); - va_end(ap2); - } - } + va_end(ap); } -void Log::outSQLDev(const char* str, ...) +void Log::outWarn(LogFilterType filter, const char * str, ...) { - if (!str) + if (!str || !ShouldLog(filter, LOG_LEVEL_WARN)) return; va_list ap; va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - printf("\n"); + vlog(filter, LOG_LEVEL_WARN, str, ap); - if (sqlDevLogFile) - { - va_list ap2; - va_start(ap2, str); - vfprintf(sqlDevLogFile, str, ap2); - va_end(ap2); - - fprintf(sqlDevLogFile, "\n"); - fflush(sqlDevLogFile); - } - - fflush(stdout); + va_end(ap); } -void Log::outDebug(DebugLogFilters f, const char * str, ...) +void Log::outError(LogFilterType filter, const char * str, ...) { - if (!(m_DebugLogMask & f)) - return; - - if (!str) + if (!str || !ShouldLog(filter, LOG_LEVEL_ERROR)) return; - if (m_enableLogDB && m_dbLogLevel > LOGL_DETAIL) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_DEBUG, nnew_str); - va_end(ap2); - } - - if ( m_logLevel > LOGL_DETAIL ) - { - if (m_colored) - SetColor(true, m_colors[LOGL_DEBUG]); - - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - if (m_colored) - ResetColor(true); + va_list ap; + va_start(ap, str); - printf( "\n" ); + vlog(filter, LOG_LEVEL_ERROR, str, ap); - if (logfile) - { - outTimestamp(logfile); - va_list ap2; - va_start(ap2, str); - vfprintf(logfile, str, ap2); - va_end(ap2); - - fprintf(logfile, "\n" ); - fflush(logfile); - } - } - fflush(stdout); + va_end(ap); } -void Log::outStaticDebug(const char * str, ...) +void Log::outFatal(LogFilterType filter, const char * str, ...) { - if (!str) + if (!str || !ShouldLog(filter, LOG_LEVEL_FATAL)) return; - if (m_enableLogDB && m_dbLogLevel > LOGL_DETAIL) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_DEBUG, nnew_str); - va_end(ap2); - } - - if ( m_logLevel > LOGL_DETAIL ) - { - if (m_colored) - SetColor(true, m_colors[LOGL_DEBUG]); - - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - if (m_colored) - ResetColor(true); + va_list ap; + va_start(ap, str); - printf( "\n" ); + vlog(filter, LOG_LEVEL_FATAL, str, ap); - if (logfile) - { - outTimestamp(logfile); - va_list ap2; - va_start(ap2, str); - vfprintf(logfile, str, ap2); - va_end(ap2); - - fprintf(logfile, "\n" ); - fflush(logfile); - } - } - fflush(stdout); + va_end(ap); } -void Log::outStringInLine(const char * str, ...) +void Log::outCommand(uint32 account, const char * str, ...) { - if (!str) + if (!str || !ShouldLog(LOG_FILTER_GMCOMMAND, LOG_LEVEL_INFO)) return; va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); + char text[MAX_QUERY_LEN]; + vsnprintf(text, MAX_QUERY_LEN, str, ap); va_end(ap); - if (logfile) - { - va_start(ap, str); - vfprintf(logfile, str, ap); - va_end(ap); - } -} - -void Log::outCommand(uint32 account, const char * str, ...) -{ - if (!str) - return; - - // TODO: support accountid - if (m_enableLogDB && m_dbGM) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_GM, nnew_str); - va_end(ap2); - } - - if (m_logLevel > LOGL_NORMAL) - { - if (m_colored) - SetColor(true, m_colors[LOGL_BASIC]); - - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); + LogMessage* msg = new LogMessage(LOG_LEVEL_INFO, LOG_FILTER_GMCOMMAND, text); + msg->param1 = account; - if (m_colored) - ResetColor(true); - - printf("\n"); - - if (logfile) - { - outTimestamp(logfile); - va_list ap2; - va_start(ap2, str); - vfprintf(logfile, str, ap2); - fprintf(logfile, "\n" ); - va_end(ap2); - fflush(logfile); - } - } - - if (m_gmlog_per_account) - { - if (FILE* per_file = openGmlogPerAccount (account)) - { - outTimestamp(per_file); - va_list ap; - va_start(ap, str); - vfprintf(per_file, str, ap); - fprintf(per_file, "\n" ); - va_end(ap); - fclose(per_file); - } - } - else if (gmLogfile) - { - outTimestamp(gmLogfile); - va_list ap; - va_start(ap, str); - vfprintf(gmLogfile, str, ap); - fprintf(gmLogfile, "\n" ); - va_end(ap); - fflush(gmLogfile); - } - - fflush(stdout); + write(msg); } -void Log::outChar(const char * str, ...) +void Log::SetRealmID(uint32 id) { - if (!str) - return; - - if (m_enableLogDB && m_dbChar) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_CHAR, nnew_str); - va_end(ap2); - } - - if (charLogfile) - { - outTimestamp(charLogfile); - va_list ap; - va_start(ap, str); - vfprintf(charLogfile, str, ap); - fprintf(charLogfile, "\n" ); - va_end(ap); - fflush(charLogfile); - } -} - -void Log::outCharDump(const char * str, uint32 account_id, uint32 guid, const char * name) -{ - FILE* file = NULL; - if (m_charLog_Dump_Separate) - { - char fileName[29]; // Max length: name(12) + guid(11) + _.log (5) + \0 - snprintf(fileName, 29, "%d_%s.log", guid, name); - std::string sFileName(m_dumpsDir); - sFileName.append(fileName); - file = fopen((m_logsDir + sFileName).c_str(), "w"); - } - else - file = charLogfile; - if (file) - { - fprintf(file, "== START DUMP == (account: %u guid: %u name: %s )\n%s\n== END DUMP ==\n", - account_id, guid, name, str); - fflush(file); - if (m_charLog_Dump_Separate) - fclose(file); - } -} - -void Log::outRemote(const char * str, ...) -{ - if (!str) - return; - - if (m_enableLogDB && m_dbRA) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_RA, nnew_str); - va_end(ap2); - } - - if (raLogfile) - { - outTimestamp(raLogfile); - va_list ap; - va_start(ap, str); - vfprintf(raLogfile, str, ap); - fprintf(raLogfile, "\n" ); - va_end(ap); - fflush(raLogfile); - } + realm = id; } -void Log::outChat(const char * str, ...) +void Log::Close() { - if (!str) - return; - - if (m_enableLogDB && m_dbChat) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_CHAT, nnew_str); - va_end(ap2); - } - - if (chatLogfile) - { - outTimestamp(chatLogfile); - va_list ap; - va_start(ap, str); - vfprintf(chatLogfile, str, ap); - fprintf(chatLogfile, "\n" ); - fflush(chatLogfile); - va_end(ap); - } -} - -void Log::outErrorST(const char * str, ...) -{ - va_list ap; - va_start(ap, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap); - va_end(ap); - - ACE_Stack_Trace st; - outError("%s [Stacktrace: %s]", nnew_str, st.c_str()); -} - -void Log::outWarden(const char * str, ...) -{ - if (!str) - return; - - if (wardenLogFile) + for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it) { - outTimestamp(wardenLogFile); - va_list ap; - va_start(ap, str); - vfprintf(wardenLogFile, str, ap); - fprintf(wardenLogFile, "\n" ); - fflush(wardenLogFile); - va_end(ap); + delete it->second; + it->second = NULL; } + appenders.clear(); + delete worker; + worker = NULL; } diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h index 296c13d86c9..5e2b7972dc8 100755 --- a/src/server/shared/Logging/Log.h +++ b/src/server/shared/Logging/Log.h @@ -19,196 +19,69 @@ #ifndef TRINITYCORE_LOG_H #define TRINITYCORE_LOG_H -#include "Common.h" -#include - -class Config; +#include "Define.h" +#include "Appender.h" +#include "LogWorker.h" +#include "Logger.h" -enum DebugLogFilters -{ - LOG_FILTER_NONE = 0x00000000, - LOG_FILTER_UNITS = 0x00000001, // Anything related to units that doesn't fit in other categories. ie. creature formations - LOG_FILTER_PETS = 0x00000002, - LOG_FILTER_VEHICLES = 0x00000004, - LOG_FILTER_TSCR = 0x00000008, // C++ AI, instance scripts, etc. - LOG_FILTER_DATABASE_AI = 0x00000010, // SmartAI, EventAI, CreatureAI - LOG_FILTER_MAPSCRIPTS = 0x00000020, - LOG_FILTER_NETWORKIO = 0x00000040, // Anything packet/netcode related - LOG_FILTER_SPELLS_AURAS = 0x00000080, - LOG_FILTER_ACHIEVEMENTSYS = 0x00000100, - LOG_FILTER_CONDITIONSYS = 0x00000200, - LOG_FILTER_POOLSYS = 0x00000400, - LOG_FILTER_AUCTIONHOUSE = 0x00000800, - LOG_FILTER_BATTLEGROUND = 0x00001000, // Anything related to arena's and battlegrounds - LOG_FILTER_OUTDOORPVP = 0x00002000, - LOG_FILTER_CHATSYS = 0x00004000, - LOG_FILTER_LFG = 0x00008000, - LOG_FILTER_MAPS = 0x00010000, // Maps, instances, grids, cells, visibility - LOG_FILTER_PLAYER_LOADING = 0x00020000, // Debug output from Player::_Load functions - LOG_FILTER_PLAYER_ITEMS = 0x00040000, // Anything item related - LOG_FILTER_PLAYER_SKILLS = 0x00080000, // Skills related - LOG_FILTER_LOOT = 0x00100000, // Loot related - LOG_FILTER_GUILD = 0x00200000, // Guild related - LOG_FILTER_TRANSPORTS = 0x00400000, // Transport related - LOG_FILTER_WARDEN = 0x00800000, // Warden related -}; - -enum LogTypes -{ - LOG_TYPE_STRING = 0, - LOG_TYPE_ERROR = 1, - LOG_TYPE_BASIC = 2, - LOG_TYPE_DETAIL = 3, - LOG_TYPE_DEBUG = 4, - LOG_TYPE_CHAR = 5, - LOG_TYPE_WORLD = 6, - LOG_TYPE_RA = 7, - LOG_TYPE_GM = 8, - LOG_TYPE_CRASH = 9, - LOG_TYPE_CHAT = 10, - MAX_LOG_TYPES -}; - -enum LogLevel -{ - LOGL_NORMAL = 0, - LOGL_BASIC, - LOGL_DETAIL, - LOGL_DEBUG -}; - -const int LogLevels = int(LOGL_DEBUG)+1; - -enum ColorTypes -{ - BLACK, - RED, - GREEN, - BROWN, - BLUE, - MAGENTA, - CYAN, - GREY, - YELLOW, - LRED, - LGREEN, - LBLUE, - LMAGENTA, - LCYAN, - WHITE -}; +#include -const int Colors = int(WHITE)+1; +#include +#include class Log { friend class ACE_Singleton; + typedef std::map LoggerMap; + private: Log(); ~Log(); public: - void Initialize(); - - void ReloadConfig(); - - void InitColors(const std::string& init_str); - void SetColor(bool stdout_stream, ColorTypes color); - void ResetColor(bool stdout_stream); - - void outErrorST(const char * err, ...) ATTR_PRINTF(2, 3); - void outDB(LogTypes type, const char * str); - void outString(const char * str, ...) ATTR_PRINTF(2, 3); - void outString(); - void outStringInLine(const char * str, ...) ATTR_PRINTF(2, 3); - void outError(const char * err, ...) ATTR_PRINTF(2, 3); - void outCrash(const char * err, ...) ATTR_PRINTF(2, 3); - void outBasic(const char * str, ...) ATTR_PRINTF(2, 3); - void outDetail(const char * str, ...) ATTR_PRINTF(2, 3); - void outSQLDev(const char * str, ...) ATTR_PRINTF(2, 3); - void outDebug(DebugLogFilters f, const char* str, ...) ATTR_PRINTF(3, 4); - void outStaticDebug(const char * str, ...) ATTR_PRINTF(2, 3); - void outDebugInLine(const char * str, ...) ATTR_PRINTF(2, 3); - void outErrorDb(const char * str, ...) ATTR_PRINTF(2, 3); - void outChar(const char * str, ...) ATTR_PRINTF(2, 3); - void outCommand(uint32 account, const char * str, ...) ATTR_PRINTF(3, 4); - void outRemote(const char * str, ...) ATTR_PRINTF(2, 3); - void outChat(const char * str, ...) ATTR_PRINTF(2, 3); - void outArena(const char * str, ...) ATTR_PRINTF(2, 3); - void outSQLDriver(const char* str, ...) ATTR_PRINTF(2, 3); - void outWarden(const char * str, ...) ATTR_PRINTF(2, 3); - void outCharDump(const char * str, uint32 account_id, uint32 guid, const char * name); - - static void outTimestamp(FILE* file); - static std::string GetTimestampStr(); + void Close(); + bool ShouldLog(LogFilterType type, LogLevel level) const; + bool SetLogLevel(std::string const& name, char const* level, bool isLogger = true); - void SetLogLevel(char * Level); - void SetLogFileLevel(char * Level); - void SetDBLogLevel(char * Level); - void SetSQLDriverQueryLogging(bool newStatus) { m_sqlDriverQueryLogging = newStatus; } - void SetRealmID(uint32 id) { realm = id; } + void log(LogFilterType f, LogLevel level, char const* str, ...) ATTR_PRINTF(4,5); + + void outTrace(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4); + void outDebug(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4); + void outInfo(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4); + void outWarn(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4); + void outError(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4); + void outFatal(LogFilterType f, char const* str, ...) ATTR_PRINTF(3,4); + + void EnableDBAppenders(); + void outCommand(uint32 account, const char * str, ...) ATTR_PRINTF(3, 4); + static std::string GetTimestampStr(); - bool IsOutDebug() const { return m_logLevel > 2 || (m_logFileLevel > 2 && logfile); } - bool IsOutCharDump() const { return m_charLog_Dump; } + void SetRealmID(uint32 id); - bool GetLogDB() const { return m_enableLogDB; } - bool GetLogDBLater() const { return m_enableLogDBLater; } - void SetLogDB(bool enable) { m_enableLogDB = enable; } - void SetLogDBLater(bool value) { m_enableLogDBLater = value; } - bool GetSQLDriverQueryLogging() const { return m_sqlDriverQueryLogging; } private: - FILE* openLogFile(char const* configFileName, char const* configTimeStampFlag, char const* mode); - FILE* openGmlogPerAccount(uint32 account); - - FILE* raLogfile; - FILE* logfile; - FILE* gmLogfile; - FILE* charLogfile; - FILE* dberLogfile; - FILE* chatLogfile; - FILE* arenaLogFile; - FILE* sqlLogFile; - FILE* sqlDevLogFile; - FILE* wardenLogFile; - - // cache values for after initilization use (like gm log per account case) + void vlog(LogFilterType f, LogLevel level, char const* str, va_list argptr); + void write(LogMessage* msg); + + Logger* GetLoggerByType(LogFilterType filter); + Appender* GetAppenderByName(std::string const& name); + uint8 NextAppenderId(); + void CreateAppenderFromConfig(const char* name); + void CreateLoggerFromConfig(const char* name); + void ReadAppendersFromConfig(); + void ReadLoggersFromConfig(); + + AppenderMap appenders; + LoggerMap loggers; + uint8 AppenderId; + std::string m_logsDir; std::string m_logsTimestamp; - // gm log control - bool m_gmlog_per_account; - std::string m_gmlog_filename_format; - - bool m_enableLogDBLater; - bool m_enableLogDB; uint32 realm; - - // log coloring - bool m_colored; - ColorTypes m_colors[4]; - - // log levels: - // false: errors only, true: full query logging - bool m_sqlDriverQueryLogging; - - // log levels: - // 0 minimum/string, 1 basic/error, 2 detail, 3 full/debug - uint8 m_dbLogLevel; - uint8 m_logLevel; - uint8 m_logFileLevel; - bool m_dbChar; - bool m_dbRA; - bool m_dbGM; - bool m_dbChat; - bool m_charLog_Dump; - bool m_charLog_Dump_Separate; - std::string m_dumpsDir; - - DebugLogFilters m_DebugLogMask; + LogWorker* worker; }; #define sLog ACE_Singleton::instance() #endif - diff --git a/src/server/shared/Logging/LogOperation.cpp b/src/server/shared/Logging/LogOperation.cpp new file mode 100644 index 00000000000..59368e519cd --- /dev/null +++ b/src/server/shared/Logging/LogOperation.cpp @@ -0,0 +1,14 @@ +#include "LogOperation.h" +#include "Logger.h" + +LogOperation::~LogOperation() +{ + delete msg; +} + +int LogOperation::call() +{ + if (logger && msg) + logger->write(*msg); + return 0; +} diff --git a/src/server/shared/Logging/LogOperation.h b/src/server/shared/Logging/LogOperation.h new file mode 100644 index 00000000000..046ff44e62e --- /dev/null +++ b/src/server/shared/Logging/LogOperation.h @@ -0,0 +1,24 @@ +#ifndef LOGOPERATION_H +#define LOGOPERATION_H + +class Logger; +struct LogMessage; + +class LogOperation +{ + public: + LogOperation(Logger* _logger, LogMessage* _msg) + : logger(_logger) + , msg(_msg) + { } + + ~LogOperation(); + + int call(); + + protected: + Logger *logger; + LogMessage *msg; +}; + +#endif diff --git a/src/server/shared/Logging/LogWorker.cpp b/src/server/shared/Logging/LogWorker.cpp new file mode 100644 index 00000000000..4dc71f7f878 --- /dev/null +++ b/src/server/shared/Logging/LogWorker.cpp @@ -0,0 +1,33 @@ +#include "LogWorker.h" + +LogWorker::LogWorker() + : m_queue(HIGH_WATERMARK, LOW_WATERMARK) +{ + ACE_Task_Base::activate(THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, 1); +} + +LogWorker::~LogWorker() +{ + m_queue.deactivate(); + wait(); +} + +int LogWorker::enqueue(LogOperation* op) +{ + return m_queue.enqueue(op); +} + +int LogWorker::svc() +{ + while (1) + { + LogOperation* request; + if (m_queue.dequeue(request) == -1) + break; + + request->call(); + delete request; + } + + return 0; +} diff --git a/src/server/shared/Logging/LogWorker.h b/src/server/shared/Logging/LogWorker.h new file mode 100644 index 00000000000..fe51be5376c --- /dev/null +++ b/src/server/shared/Logging/LogWorker.h @@ -0,0 +1,30 @@ +#ifndef LOGWORKER_H +#define LOGWORKER_H + +#include "LogOperation.h" + +#include +#include + +class LogWorker: protected ACE_Task_Base +{ + public: + LogWorker(); + ~LogWorker(); + + typedef ACE_Message_Queue_Ex LogMessageQueueType; + + enum + { + HIGH_WATERMARK = 8 * 1024 * 1024, + LOW_WATERMARK = 8 * 1024 * 1024 + }; + + int enqueue(LogOperation *op); + + private: + virtual int svc(); + LogMessageQueueType m_queue; +}; + +#endif diff --git a/src/server/shared/Logging/Logger.cpp b/src/server/shared/Logging/Logger.cpp new file mode 100644 index 00000000000..7464012c0ac --- /dev/null +++ b/src/server/shared/Logging/Logger.cpp @@ -0,0 +1,67 @@ +#include "Logger.h" + +Logger::Logger(): name(""), type(LOG_FILTER_GENERAL), level(LOG_LEVEL_DISABLED) +{ +} + +void Logger::Create(std::string const& _name, LogFilterType _type, LogLevel _level) +{ + name = _name; + type = _type; + level = _level; +} + +Logger::~Logger() +{ + for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it) + it->second = NULL; + appenders.clear(); +} + +std::string const& Logger::getName() const +{ + return name; +} + +LogFilterType Logger::getType() const +{ + return type; +} + +LogLevel Logger::getLogLevel() const +{ + return level; +} + +void Logger::addAppender(uint8 id, Appender* appender) +{ + appenders[id] = appender; +} + +void Logger::delAppender(uint8 id) +{ + AppenderMap::iterator it = appenders.find(id); + if (it != appenders.end()) + { + it->second = NULL; + appenders.erase(it); + } +} + +void Logger::setLogLevel(LogLevel _level) +{ + level = _level; +} + +void Logger::write(LogMessage& message) +{ + if (!level || level > message.level || message.text.empty()) + { + //fprintf(stderr, "Logger::write: Logger %s, Level %u. Msg %s Level %u WRONG LEVEL MASK OR EMPTY MSG\n", getName().c_str(), messge.level, message.text.c_str(), .message.level); // DEBUG - RemoveMe + return; + } + + for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it) + if (it->second) + it->second->write(message); +} diff --git a/src/server/shared/Logging/Logger.h b/src/server/shared/Logging/Logger.h new file mode 100644 index 00000000000..10b3991a537 --- /dev/null +++ b/src/server/shared/Logging/Logger.h @@ -0,0 +1,29 @@ +#ifndef LOGGER_H +#define LOGGER_H + +#include "Appender.h" + +class Logger +{ + public: + Logger(); + ~Logger(); + + void Create(std::string const& name, LogFilterType type, LogLevel level); + void addAppender(uint8 type, Appender *); + void delAppender(uint8 type); + + std::string const& getName() const; + LogFilterType getType() const; + LogLevel getLogLevel() const; + void setLogLevel(LogLevel level); + void write(LogMessage& message); + + private: + std::string name; + LogFilterType type; + LogLevel level; + AppenderMap appenders; +}; + +#endif -- cgit v1.2.3 From 634776e0bcc90e610a3f736e8ddf75792ad9b73e Mon Sep 17 00:00:00 2001 From: Spp Date: Fri, 3 Aug 2012 15:54:54 +0200 Subject: Fix compile under windows --- src/server/game/AI/EventAI/CreatureEventAIMgr.cpp | 2 +- src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 6 +- src/server/game/Achievements/AchievementMgr.cpp | 24 +- src/server/game/Addons/AddonMgr.cpp | 4 +- src/server/game/AuctionHouse/AuctionHouseMgr.cpp | 12 +- src/server/game/Battlegrounds/ArenaTeamMgr.cpp | 4 +- src/server/game/Battlegrounds/BattlegroundMgr.cpp | 10 +- .../game/Battlegrounds/Zones/BattlegroundRV.cpp | 2 +- src/server/game/Conditions/ConditionMgr.cpp | 4 +- src/server/game/Conditions/DisableMgr.cpp | 8 +- src/server/game/DataStores/DBCStores.cpp | 2 +- src/server/game/DungeonFinding/LFGMgr.cpp | 4 +- .../game/Entities/Creature/CreatureGroups.cpp | 4 +- .../game/Entities/Item/ItemEnchantmentMgr.cpp | 4 +- src/server/game/Entities/Transport/Transport.cpp | 8 +- src/server/game/Events/GameEventMgr.cpp | 66 ++--- src/server/game/Globals/ObjectMgr.cpp | 268 ++++++++++----------- src/server/game/Groups/GroupMgr.cpp | 12 +- src/server/game/Guilds/GuildMgr.cpp | 34 +-- src/server/game/Instances/InstanceSaveMgr.cpp | 2 +- src/server/game/Loot/LootMgr.cpp | 24 +- .../game/Movement/Waypoints/WaypointManager.cpp | 4 +- src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp | 4 +- src/server/game/Scripting/ScriptMgr.cpp | 2 +- src/server/game/Scripting/ScriptSystem.cpp | 14 +- src/server/game/Skills/SkillDiscovery.cpp | 4 +- src/server/game/Skills/SkillExtraItems.cpp | 4 +- src/server/game/Spells/SpellMgr.cpp | 74 +++--- src/server/game/Texts/CreatureTextMgr.cpp | 6 +- src/server/game/Tickets/TicketMgr.cpp | 6 +- src/server/game/Tools/CharacterDatabaseCleaner.cpp | 2 +- src/server/game/Warden/WardenCheckMgr.cpp | 12 +- src/server/game/Weather/WeatherMgr.cpp | 4 +- src/server/game/World/World.cpp | 14 +- src/server/shared/AutoPtr.h | 2 +- src/server/shared/Database/MySQLConnection.cpp | 2 +- src/server/shared/Logging/Appender.h | 2 +- src/server/shared/Packets/ByteBuffer.h | 8 +- 38 files changed, 334 insertions(+), 334 deletions(-) (limited to 'src/server/shared/Logging') diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp index 2d7c64bf5df..7289a4eed28 100755 --- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -209,7 +209,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() sLog->outError(LOG_FILTER_SQL, "CreatureEventAI: Event %u has script for non-existing creature entry (%u), skipping.", i, creature_id); continue; } - + // Only on the first script if (cInfo->AIName != "EventAI" && m_CreatureEventAI_Event_Map[creature_id].empty()) sLog->outError(LOG_FILTER_SQL, "Creature entry %u has EventAI scripts, but its AIName is not 'EventAI' - possible AI-mismatch?", temp.creature_id); diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 1723e96a08a..7a997609b5d 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -51,7 +51,7 @@ void SmartWaypointMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty."); - + return; } @@ -89,7 +89,7 @@ void SmartWaypointMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime)); - + } SmartWaypointMgr::~SmartWaypointMgr() @@ -118,7 +118,7 @@ void SmartAIMgr::LoadSmartAIFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 SmartAI scripts. DB table `smartai_scripts` is empty."); - + return; } diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index be4ce974f70..191d91b61a7 100755 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -2202,7 +2202,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList() if (sAchievementCriteriaStore.GetNumRows() == 0) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 achievement criteria."); - + return; } @@ -2220,7 +2220,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList() } sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu achievement criteria in %u ms", (unsigned long)m_AchievementCriteriasByType->size(), GetMSTimeDiffToNow(oldMSTime)); - + } void AchievementGlobalMgr::LoadAchievementReferenceList() @@ -2230,7 +2230,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList() if (sAchievementStore.GetNumRows() == 0) { sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 achievement references."); - + return; } @@ -2251,7 +2251,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList() const_cast(achievement)->mapID = 631; // Correct map requirement (currently has Ulduar) sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void AchievementGlobalMgr::LoadAchievementCriteriaData() @@ -2265,7 +2265,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() if (!result) { sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty."); - + return; } @@ -2397,7 +2397,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() } sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void AchievementGlobalMgr::LoadCompletedAchievements() @@ -2409,7 +2409,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements() if (!result) { sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 completed achievements. DB table `character_achievement` is empty."); - + return; } @@ -2437,7 +2437,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime)); - + } void AchievementGlobalMgr::LoadRewards() @@ -2452,7 +2452,7 @@ void AchievementGlobalMgr::LoadRewards() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty."); - + return; } @@ -2544,7 +2544,7 @@ void AchievementGlobalMgr::LoadRewards() while (result->NextRow()); sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void AchievementGlobalMgr::LoadRewardLocales() @@ -2560,7 +2560,7 @@ void AchievementGlobalMgr::LoadRewardLocales() if (!result) { sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty"); - + return; } @@ -2587,5 +2587,5 @@ void AchievementGlobalMgr::LoadRewardLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime)); - + } diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp index 2d1d02cf5d1..6af87827917 100755 --- a/src/server/game/Addons/AddonMgr.cpp +++ b/src/server/game/Addons/AddonMgr.cpp @@ -44,7 +44,7 @@ void LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 known addons. DB table `addons` is empty!"); - + return; } @@ -64,7 +64,7 @@ void LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SaveAddon(AddonInfo const& addon) diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 57ab63cdd16..ab08262a928 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -264,7 +264,7 @@ void AuctionHouseMgr::LoadAuctionItems() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!"); - + return; } @@ -297,7 +297,7 @@ void AuctionHouseMgr::LoadAuctionItems() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void AuctionHouseMgr::LoadAuctions() @@ -310,7 +310,7 @@ void AuctionHouseMgr::LoadAuctions() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 auctions. DB table `auctionhouse` is empty."); - + return; } @@ -336,7 +336,7 @@ void AuctionHouseMgr::LoadAuctions() CharacterDatabase.CommitTransaction(trans); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void AuctionHouseMgr::AddAItem(Item* it) @@ -735,7 +735,7 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup() if (!expAuctions) { sLog->outInfo(LOG_FILTER_GENERAL, ">> No expired auctions to delete"); - + return; } @@ -783,7 +783,7 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup() } while (expAuctions->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime)); - + } diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp index a36be0e7749..665742c97b1 100644 --- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp +++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp @@ -102,7 +102,7 @@ void ArenaTeamMgr::LoadArenaTeams() if (!result) { sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded 0 arena teams. DB table `arena_team` is empty!"); - + return; } @@ -133,7 +133,7 @@ void ArenaTeamMgr::LoadArenaTeams() while (result->NextRow()); sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ArenaTeamMgr::DistributeArenaPoints() diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index b2615d3e54c..290da0bb31f 100755 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -684,7 +684,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 battlegrounds. DB table `battleground_template` is empty."); - + return; } @@ -772,7 +772,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() } data.StartMaxDist = fields[9].GetFloat(); - + selectionWeight = fields[10].GetUInt8(); data.scriptId = sObjectMgr->GetScriptId(fields[11].GetCString()); data.BattlegroundName = bl->name[sWorld->GetDefaultDbcLocale()]; @@ -793,7 +793,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() while (result->NextRow()); sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void BattlegroundMgr::InitAutomaticArenaPointDistribution() @@ -1078,7 +1078,7 @@ void BattlegroundMgr::LoadBattleMastersEntry() if (!result) { sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!"); - + return; } @@ -1103,7 +1103,7 @@ void BattlegroundMgr::LoadBattleMastersEntry() while (result->NextRow()); sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } HolidayIds BattlegroundMgr::BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index 561cac54025..769df5445c7 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -245,6 +245,6 @@ void BattlegroundRV::TogglePillarCollision() gob->SendUpdateToPlayer(player); } } - + SetPillarCollision(!apply); } \ No newline at end of file diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index e6acefcce48..67ba643dd97 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -713,7 +713,7 @@ void ConditionMgr::LoadConditions(bool isReload) if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 conditions. DB table `conditions` is empty!"); - + return; } @@ -927,7 +927,7 @@ void ConditionMgr::LoadConditions(bool isReload) while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } bool ConditionMgr::addToLootTemplate(Condition* cond, LootTemplate* loot) diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp index 99a492a224e..6215cf5bb75 100755 --- a/src/server/game/Conditions/DisableMgr.cpp +++ b/src/server/game/Conditions/DisableMgr.cpp @@ -60,7 +60,7 @@ void LoadDisables() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 disables. DB table `disables` is empty!"); - + return; } @@ -229,7 +229,7 @@ void LoadDisables() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime)); - + } void CheckQuestDisables() @@ -240,7 +240,7 @@ void CheckQuestDisables() if (!count) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Checked 0 quest disables."); - + return; } @@ -260,7 +260,7 @@ void CheckQuestDisables() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags) diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index abf385b1463..48ceda2a212 100755 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -637,7 +637,7 @@ void LoadDBCStores(const std::string& dataPath) } sLog->outInfo(LOG_FILTER_GENERAL, ">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime)); - + } SimpleFactionsList const* GetFactionTeamList(uint32 faction) diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 05385361e1b..3a2a044ca3b 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -136,7 +136,7 @@ void LFGMgr::LoadRewards() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!"); - + return; } @@ -184,7 +184,7 @@ void LFGMgr::LoadRewards() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_LFG, ">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void LFGMgr::Update(uint32 diff) diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp index 6468e611b13..21ed1a23828 100755 --- a/src/server/game/Entities/Creature/CreatureGroups.cpp +++ b/src/server/game/Entities/Creature/CreatureGroups.cpp @@ -85,7 +85,7 @@ void FormationMgr::LoadCreatureFormations() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!"); - + return; } @@ -137,7 +137,7 @@ void FormationMgr::LoadCreatureFormations() while (result->NextRow()); sLog->outInfo(LOG_FILTER_UNITS, ">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void CreatureGroup::AddMember(Creature* member) diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp index c6ed8a2925a..0478173b96e 100755 --- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp +++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp @@ -71,12 +71,12 @@ void LoadRandomEnchantmentsTable() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_PLAYER_ITEMS, ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } else { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty."); - + } } diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 238b6e9cd5a..52d5c9114ff 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -36,7 +36,7 @@ void MapManager::LoadTransports() if (!result) { sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded 0 transports. DB table `transports` is empty!"); - + return; } @@ -122,7 +122,7 @@ void MapManager::LoadTransports() } sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded %u transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void MapManager::LoadTransportNPCs() @@ -135,7 +135,7 @@ void MapManager::LoadTransportNPCs() if (!result) { sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded 0 transport NPCs. DB table `creature_transport` is empty!"); - + return; } @@ -167,7 +167,7 @@ void MapManager::LoadTransportNPCs() while (result->NextRow()); sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded %u transport npcs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } Transport::Transport(uint32 period, uint32 script) : GameObject(), m_pathTime(0), m_timer(0), diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index e1141f785e1..afbae063e5e 100755 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -211,7 +211,7 @@ void GameEventMgr::LoadFromDB() { mGameEvent.clear(); sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 game events. DB table `game_event` is empty."); - + return; } @@ -261,7 +261,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Saves Data..."); @@ -274,7 +274,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty."); - + } else { @@ -307,7 +307,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -320,7 +320,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty."); - + } else { @@ -358,7 +358,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -373,7 +373,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty"); - + } else { @@ -401,7 +401,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -416,7 +416,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty."); - + } else { @@ -444,7 +444,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -459,7 +459,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty."); - + } else { @@ -501,7 +501,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -515,7 +515,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty."); - + } else { @@ -542,7 +542,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -556,7 +556,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty."); - + } else { @@ -583,7 +583,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -597,7 +597,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty."); - + } else { @@ -626,7 +626,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -640,7 +640,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty."); - + } else { @@ -668,7 +668,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -682,7 +682,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty."); - + } else { @@ -716,7 +716,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -730,7 +730,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty."); - + } else { @@ -756,7 +756,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -770,7 +770,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty."); - + } else { @@ -800,7 +800,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -814,7 +814,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty."); - + } else { @@ -866,7 +866,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -880,7 +880,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 battleground holidays in game events. DB table `game_event_condition` is empty."); - + } else { @@ -904,7 +904,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -919,7 +919,7 @@ void GameEventMgr::LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 pools for game events. DB table `game_event_pool` is empty."); - + } else { @@ -953,7 +953,7 @@ void GameEventMgr::LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } } @@ -1030,7 +1030,7 @@ void GameEventMgr::StartArenaSeason() StartEvent(eventId, true); sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Arena Season %u started...", season); - + } uint32 GameEventMgr::Update() // return the next event delay in ms diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 9cbf9ed1ee2..fc4386633ff 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -297,7 +297,7 @@ void ObjectMgr::LoadCreatureLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadGossipMenuItemsLocales() @@ -334,7 +334,7 @@ void ObjectMgr::LoadGossipMenuItemsLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadPointOfInterestLocales() @@ -361,7 +361,7 @@ void ObjectMgr::LoadPointOfInterestLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadCreatureTemplates() @@ -389,7 +389,7 @@ void ObjectMgr::LoadCreatureTemplates() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature template definitions. DB table `creature_template` is empty."); - + return; } @@ -492,7 +492,7 @@ void ObjectMgr::LoadCreatureTemplates() CheckCreatureTemplate(&itr->second); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadCreatureTemplateAddons() @@ -505,7 +505,7 @@ void ObjectMgr::LoadCreatureTemplateAddons() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty."); - + return; } @@ -564,7 +564,7 @@ void ObjectMgr::LoadCreatureTemplateAddons() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) @@ -882,7 +882,7 @@ void ObjectMgr::LoadCreatureAddons() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty."); - + return; } @@ -948,7 +948,7 @@ void ObjectMgr::LoadCreatureAddons() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } CreatureAddon const* ObjectMgr::GetCreatureAddon(uint32 lowguid) @@ -987,7 +987,7 @@ void ObjectMgr::LoadEquipmentTemplates() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!"); - + return; } @@ -1040,7 +1040,7 @@ void ObjectMgr::LoadEquipmentTemplates() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelId) @@ -1118,7 +1118,7 @@ void ObjectMgr::LoadCreatureModelInfo() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty."); - + return; } @@ -1163,7 +1163,7 @@ void ObjectMgr::LoadCreatureModelInfo() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadLinkedRespawn() @@ -1177,7 +1177,7 @@ void ObjectMgr::LoadLinkedRespawn() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 linked respawns. DB table `linked_respawn` is empty."); - + return; } @@ -1349,7 +1349,7 @@ void ObjectMgr::LoadLinkedRespawn() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime)); - + } bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow) @@ -1409,7 +1409,7 @@ void ObjectMgr::LoadCreatures() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creatures. DB table `creature` is empty."); - + return; } @@ -1536,7 +1536,7 @@ void ObjectMgr::LoadCreatures() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data) @@ -1719,7 +1719,7 @@ void ObjectMgr::LoadGameobjects() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gameobjects. DB table `gameobject` is empty."); - + return; } @@ -1841,7 +1841,7 @@ void ObjectMgr::LoadGameobjects() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data) @@ -2010,7 +2010,7 @@ void ObjectMgr::LoadItemLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadItemTemplates() @@ -2053,7 +2053,7 @@ void ObjectMgr::LoadItemTemplates() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 item templates. DB table `item_template` is empty."); - + return; } @@ -2615,7 +2615,7 @@ void ObjectMgr::LoadItemTemplates() sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } ItemTemplate const* ObjectMgr::GetItemTemplate(uint32 entry) @@ -2651,7 +2651,7 @@ void ObjectMgr::LoadItemSetNameLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadItemSetNames() @@ -2680,7 +2680,7 @@ void ObjectMgr::LoadItemSetNames() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 item set names. DB table `item_set_names` is empty."); - + return; } @@ -2735,7 +2735,7 @@ void ObjectMgr::LoadItemSetNames() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadVehicleTemplateAccessories() @@ -2752,7 +2752,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 vehicle template accessories. DB table `vehicle_template_accessory` is empty."); - + return; } @@ -2792,7 +2792,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadVehicleAccessories() @@ -2809,7 +2809,7 @@ void ObjectMgr::LoadVehicleAccessories() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + return; } @@ -2837,7 +2837,7 @@ void ObjectMgr::LoadVehicleAccessories() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadPetLevelInfo() @@ -2850,7 +2850,7 @@ void ObjectMgr::LoadPetLevelInfo() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level pet stats definitions. DB table `pet_levelstats` is empty."); - + return; } @@ -2930,7 +2930,7 @@ void ObjectMgr::LoadPetLevelInfo() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } PetLevelInfo const* ObjectMgr::GetPetLevelInfo(uint32 creature_id, uint8 level) const @@ -2996,7 +2996,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 player create definitions. DB table `playercreateinfo` is empty."); exit(1); } @@ -3072,7 +3072,7 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -3086,7 +3086,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty."); - + } else { @@ -3144,7 +3144,7 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -3159,7 +3159,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 player create spells. DB table `%s` is empty.", sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS) ? "playercreateinfo_spell_custom" : "playercreateinfo_spell"); - + } else { @@ -3201,7 +3201,7 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -3216,7 +3216,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 player create actions. DB table `playercreateinfo_action` is empty."); - + } else { @@ -3248,7 +3248,7 @@ void ObjectMgr::LoadPlayerInfo() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -3263,7 +3263,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level health/mana definitions. DB table `game_event_condition` is empty."); - + exit(1); } @@ -3330,7 +3330,7 @@ void ObjectMgr::LoadPlayerInfo() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } // Loading levels data (class/race dependent) @@ -3344,7 +3344,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level stats definitions. DB table `player_levelstats` is empty."); - + exit(1); } @@ -3444,7 +3444,7 @@ void ObjectMgr::LoadPlayerInfo() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } // Loading xp per level data @@ -3462,7 +3462,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 xp for level definitions. DB table `player_xp_for_level` is empty."); - + exit(1); } @@ -3503,7 +3503,7 @@ void ObjectMgr::LoadPlayerInfo() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -3661,7 +3661,7 @@ void ObjectMgr::LoadQuests() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 quests definitions. DB table `quest_template` is empty."); - + return; } @@ -4290,7 +4290,7 @@ void ObjectMgr::LoadQuests() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadQuestLocales() @@ -4339,7 +4339,7 @@ void ObjectMgr::LoadQuestLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadScripts(ScriptsType type) @@ -4368,7 +4368,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str()); - + return; } @@ -4660,7 +4660,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadGameObjectScripts() @@ -4805,7 +4805,7 @@ void ObjectMgr::LoadSpellScriptNames() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 spell script names. DB table `spell_script_names` is empty!"); - + return; } @@ -4853,7 +4853,7 @@ void ObjectMgr::LoadSpellScriptNames() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::ValidateSpellScripts() @@ -4863,7 +4863,7 @@ void ObjectMgr::ValidateSpellScripts() if (_spellScriptsStore.empty()) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Validated 0 scripts."); - + return; } @@ -4911,7 +4911,7 @@ void ObjectMgr::ValidateSpellScripts() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadPageTexts() @@ -4924,7 +4924,7 @@ void ObjectMgr::LoadPageTexts() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 page texts. DB table `page_text` is empty!"); - + return; } @@ -4954,7 +4954,7 @@ void ObjectMgr::LoadPageTexts() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } PageText const* ObjectMgr::GetPageText(uint32 pageEntry) @@ -4990,7 +4990,7 @@ void ObjectMgr::LoadPageTextLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadInstanceTemplate() @@ -5003,7 +5003,7 @@ void ObjectMgr::LoadInstanceTemplate() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 instance templates. DB table `page_text` is empty!"); - + return; } @@ -5033,7 +5033,7 @@ void ObjectMgr::LoadInstanceTemplate() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } InstanceTemplate const* ObjectMgr::GetInstanceTemplate(uint32 mapID) @@ -5054,7 +5054,7 @@ void ObjectMgr::LoadInstanceEncounters() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 instance encounters, table is empty!"); - + return; } @@ -5123,7 +5123,7 @@ void ObjectMgr::LoadInstanceEncounters() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } GossipText const* ObjectMgr::GetGossipText(uint32 Text_ID) const @@ -5144,7 +5144,7 @@ void ObjectMgr::LoadGossipText() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u npc texts", count); - + return; } _gossipTextStore.rehash(result->GetRowCount()); @@ -5184,7 +5184,7 @@ void ObjectMgr::LoadGossipText() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadNpcTextLocales() @@ -5227,7 +5227,7 @@ void ObjectMgr::LoadNpcTextLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - + } //not very fast function but it is called only once a day, or on starting-up @@ -5253,7 +5253,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> No expired mails found."); - + return; // any mails need to be returned or deleted } @@ -5357,7 +5357,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadQuestAreaTriggers() @@ -5371,7 +5371,7 @@ void ObjectMgr::LoadQuestAreaTriggers() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty."); - + return; } @@ -5416,7 +5416,7 @@ void ObjectMgr::LoadQuestAreaTriggers() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadTavernAreaTriggers() @@ -5430,7 +5430,7 @@ void ObjectMgr::LoadTavernAreaTriggers() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty."); - + return; } @@ -5455,7 +5455,7 @@ void ObjectMgr::LoadTavernAreaTriggers() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadAreaTriggerScripts() @@ -5468,7 +5468,7 @@ void ObjectMgr::LoadAreaTriggerScripts() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty."); - + return; } @@ -5493,7 +5493,7 @@ void ObjectMgr::LoadAreaTriggerScripts() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team) @@ -5612,7 +5612,7 @@ void ObjectMgr::LoadGraveyardZones() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty."); - + return; } @@ -5659,7 +5659,7 @@ void ObjectMgr::LoadGraveyardZones() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } WorldSafeLocsEntry const* ObjectMgr::GetDefaultGraveYard(uint32 team) @@ -5905,7 +5905,7 @@ void ObjectMgr::LoadAreaTriggerTeleports() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty."); - + return; } @@ -5952,7 +5952,7 @@ void ObjectMgr::LoadAreaTriggerTeleports() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadAccessRequirements() @@ -5966,7 +5966,7 @@ void ObjectMgr::LoadAccessRequirements() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty."); - + return; } @@ -6044,7 +6044,7 @@ void ObjectMgr::LoadAccessRequirements() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } /* @@ -6269,7 +6269,7 @@ void ObjectMgr::LoadGameObjectLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); - + } inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N) @@ -6346,7 +6346,7 @@ void ObjectMgr::LoadGameObjectTemplate() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty."); - + return; } @@ -6516,7 +6516,7 @@ void ObjectMgr::LoadGameObjectTemplate() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadExplorationBaseXP() @@ -6528,7 +6528,7 @@ void ObjectMgr::LoadExplorationBaseXP() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 BaseXP definitions. DB table `exploration_basexp` is empty."); - + return; } @@ -6545,7 +6545,7 @@ void ObjectMgr::LoadExplorationBaseXP() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } uint32 ObjectMgr::GetBaseXP(uint8 level) @@ -6569,7 +6569,7 @@ void ObjectMgr::LoadPetNames() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!"); - + return; } @@ -6590,7 +6590,7 @@ void ObjectMgr::LoadPetNames() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadPetNumber() @@ -6605,7 +6605,7 @@ void ObjectMgr::LoadPetNumber() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime)); - + } std::string ObjectMgr::GeneratePetName(uint32 entry) @@ -6639,7 +6639,7 @@ void ObjectMgr::LoadCorpses() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 corpses. DB table `corpse` is empty."); - + return; } @@ -6668,7 +6668,7 @@ void ObjectMgr::LoadCorpses() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadReputationRewardRate() @@ -6683,7 +6683,7 @@ void ObjectMgr::LoadReputationRewardRate() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded `reputation_reward_rate`, table is empty!"); - + return; } @@ -6731,7 +6731,7 @@ void ObjectMgr::LoadReputationRewardRate() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadReputationOnKill() @@ -6752,7 +6752,7 @@ void ObjectMgr::LoadReputationOnKill() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creature award reputation definitions. DB table `creature_onkill_reputation` is empty."); - + return; } @@ -6805,7 +6805,7 @@ void ObjectMgr::LoadReputationOnKill() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadReputationSpilloverTemplate() @@ -6820,7 +6820,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded `reputation_spillover_template`, table is empty."); - + return; } @@ -6917,7 +6917,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadPointsOfInterest() @@ -6934,7 +6934,7 @@ void ObjectMgr::LoadPointsOfInterest() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Points of Interest definitions. DB table `points_of_interest` is empty."); - + return; } @@ -6964,7 +6964,7 @@ void ObjectMgr::LoadPointsOfInterest() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadQuestPOI() @@ -6981,7 +6981,7 @@ void ObjectMgr::LoadQuestPOI() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 quest POI definitions. DB table `quest_poi` is empty."); - + return; } @@ -7036,7 +7036,7 @@ void ObjectMgr::LoadQuestPOI() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadNPCSpellClickSpells() @@ -7050,7 +7050,7 @@ void ObjectMgr::LoadNPCSpellClickSpells() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spellclick spells. DB table `npc_spellclick_spells` is empty."); - + return; } @@ -7104,7 +7104,7 @@ void ObjectMgr::LoadNPCSpellClickSpells() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::DeleteCreatureData(uint32 guid) @@ -7154,7 +7154,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table, if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 quest relations from `%s`, table is empty.", table.c_str()); - + return; } @@ -7183,7 +7183,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table, } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadGameobjectQuestRelations() @@ -7253,7 +7253,7 @@ void ObjectMgr::LoadReservedPlayersNames() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 reserved player names. DB table `reserved_name` is empty!"); - + return; } @@ -7280,7 +7280,7 @@ void ObjectMgr::LoadReservedPlayersNames() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } bool ObjectMgr::IsReservedName(const std::string& name) const @@ -7434,7 +7434,7 @@ void ObjectMgr::LoadGameObjectForQuests() if (sObjectMgr->GetGameObjectTemplates()->empty()) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 GameObjects for quests"); - + return; } @@ -7483,7 +7483,7 @@ void ObjectMgr::LoadGameObjectForQuests() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max_value) @@ -7532,7 +7532,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table); else sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 string templates. DB table `%s` is empty.", table); - + return false; } @@ -7575,7 +7575,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max else sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime)); - + return true; } @@ -7607,7 +7607,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 areas for fishing base skill level. DB table `skill_fishing_base_level` is empty."); - + return; } @@ -7632,7 +7632,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } bool ObjectMgr::CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& names) @@ -7716,7 +7716,7 @@ void ObjectMgr::LoadGameTele() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 GameTeleports. DB table `game_tele` is empty!"); - + return; } @@ -7758,7 +7758,7 @@ void ObjectMgr::LoadGameTele() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } GameTele const* ObjectMgr::GetGameTele(const std::string& name) const @@ -7857,7 +7857,7 @@ void ObjectMgr::LoadMailLevelRewards() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 level dependent mail rewards. DB table `mail_level_reward` is empty."); - + return; } @@ -7903,7 +7903,7 @@ void ObjectMgr::LoadMailLevelRewards() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, uint32 reqSkill, uint32 reqSkillValue, uint32 reqLevel) @@ -8000,7 +8000,7 @@ void ObjectMgr::LoadTrainerSpell() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Trainers. DB table `npc_trainer` is empty!"); - + return; } @@ -8024,7 +8024,7 @@ void ObjectMgr::LoadTrainerSpell() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set *skip_vendors) @@ -8080,7 +8080,7 @@ void ObjectMgr::LoadVendors() QueryResult result = WorldDatabase.Query("SELECT entry, item, maxcount, incrtime, ExtendedCost FROM npc_vendor ORDER BY entry, slot ASC"); if (!result) { - + sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Vendors. DB table `npc_vendor` is empty!"); return; } @@ -8115,7 +8115,7 @@ void ObjectMgr::LoadVendors() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadGossipMenu() @@ -8129,7 +8129,7 @@ void ObjectMgr::LoadGossipMenu() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gossip_menu entries. DB table `gossip_menu` is empty!"); - + return; } @@ -8157,7 +8157,7 @@ void ObjectMgr::LoadGossipMenu() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadGossipMenuItems() @@ -8176,7 +8176,7 @@ void ObjectMgr::LoadGossipMenuItems() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gossip_menu_option entries. DB table `gossip_menu_option` is empty!"); - + return; } @@ -8221,7 +8221,7 @@ void ObjectMgr::LoadGossipMenuItems() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::AddVendorItem(uint32 entry, uint32 item, int32 maxcount, uint32 incrtime, uint32 extendedCost, bool persist /*= true*/) @@ -8384,7 +8384,7 @@ void ObjectMgr::LoadScriptNames() if (!result) { - + sLog->outError(LOG_FILTER_SQL, ">> Loaded empty set of Script Names!"); return; } @@ -8400,7 +8400,7 @@ void ObjectMgr::LoadScriptNames() std::sort(_scriptNamesStore.begin(), _scriptNamesStore.end()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } uint32 ObjectMgr::GetScriptId(const char *name) @@ -8504,7 +8504,7 @@ void ObjectMgr::LoadCreatureClassLevelStats() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty."); - + return; } @@ -8553,7 +8553,7 @@ void ObjectMgr::LoadCreatureClassLevelStats() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadFactionChangeAchievements() @@ -8565,7 +8565,7 @@ void ObjectMgr::LoadFactionChangeAchievements() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 faction change achievement pairs. DB table `player_factionchange_achievement` is empty."); - + return; } @@ -8590,7 +8590,7 @@ void ObjectMgr::LoadFactionChangeAchievements() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadFactionChangeItems() @@ -8602,7 +8602,7 @@ void ObjectMgr::LoadFactionChangeItems() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty."); - + return; } @@ -8627,7 +8627,7 @@ void ObjectMgr::LoadFactionChangeItems() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadFactionChangeSpells() @@ -8639,7 +8639,7 @@ void ObjectMgr::LoadFactionChangeSpells() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 faction change spell pairs. DB table `player_factionchange_spells` is empty."); - + return; } @@ -8664,7 +8664,7 @@ void ObjectMgr::LoadFactionChangeSpells() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void ObjectMgr::LoadFactionChangeReputations() @@ -8676,7 +8676,7 @@ void ObjectMgr::LoadFactionChangeReputations() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty."); - + return; } @@ -8701,7 +8701,7 @@ void ObjectMgr::LoadFactionChangeReputations() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } GameObjectTemplate const* ObjectMgr::GetGameObjectTemplate(uint32 entry) diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp index acec13ab2c3..3a758f6df30 100644 --- a/src/server/game/Groups/GroupMgr.cpp +++ b/src/server/game/Groups/GroupMgr.cpp @@ -126,7 +126,7 @@ void GroupMgr::LoadGroups() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group definitions. DB table `groups` is empty!"); - + return; } @@ -152,7 +152,7 @@ void GroupMgr::LoadGroups() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } sLog->outInfo(LOG_FILTER_GENERAL, "Loading Group members..."); @@ -170,7 +170,7 @@ void GroupMgr::LoadGroups() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group members. DB table `group_member` is empty!"); - + return; } @@ -191,7 +191,7 @@ void GroupMgr::LoadGroups() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } sLog->outInfo(LOG_FILTER_GENERAL, "Loading Group instance saves..."); @@ -204,7 +204,7 @@ void GroupMgr::LoadGroups() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group-instance saves. DB table `group_instance` is empty!"); - + return; } @@ -236,6 +236,6 @@ void GroupMgr::LoadGroups() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp index 35a217200ad..dab67c59d2a 100644 --- a/src/server/game/Guilds/GuildMgr.cpp +++ b/src/server/game/Guilds/GuildMgr.cpp @@ -106,7 +106,7 @@ void GuildMgr::LoadGuilds() if (!result) { sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild definitions. DB table `guild` is empty."); - + return; } else @@ -129,7 +129,7 @@ void GuildMgr::LoadGuilds() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -147,7 +147,7 @@ void GuildMgr::LoadGuilds() if (!result) { sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild ranks. DB table `guild_rank` is empty."); - + } else { @@ -165,7 +165,7 @@ void GuildMgr::LoadGuilds() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -190,7 +190,7 @@ void GuildMgr::LoadGuilds() if (!result) { sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild members. DB table `guild_member` is empty."); - + } else { @@ -209,7 +209,7 @@ void GuildMgr::LoadGuilds() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild members int %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -227,7 +227,7 @@ void GuildMgr::LoadGuilds() if (!result) { sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty."); - + } else { @@ -245,7 +245,7 @@ void GuildMgr::LoadGuilds() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -262,7 +262,7 @@ void GuildMgr::LoadGuilds() if (!result) { sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty."); - + } else { @@ -280,7 +280,7 @@ void GuildMgr::LoadGuilds() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -298,7 +298,7 @@ void GuildMgr::LoadGuilds() if (!result) { sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty."); - + } else { @@ -316,7 +316,7 @@ void GuildMgr::LoadGuilds() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -334,7 +334,7 @@ void GuildMgr::LoadGuilds() if (!result) { sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty."); - + } else { @@ -352,7 +352,7 @@ void GuildMgr::LoadGuilds() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -372,7 +372,7 @@ void GuildMgr::LoadGuilds() if (!result) { sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty."); - + } else { @@ -390,7 +390,7 @@ void GuildMgr::LoadGuilds() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } } @@ -413,6 +413,6 @@ void GuildMgr::LoadGuilds() } sLog->outInfo(LOG_FILTER_GUILD, ">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + } } diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index 6e76f37c9d6..4ca7f97c02b 100755 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -276,7 +276,7 @@ void InstanceSaveManager::LoadInstances() sInstanceSaveMgr->LoadResetTimes(); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded instances in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + } void InstanceSaveManager::LoadResetTimes() diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index ddacf64507f..6f49a555950 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -1481,7 +1481,7 @@ void LoadLootTemplates_Creature() else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty"); - + } void LoadLootTemplates_Disenchant() @@ -1515,7 +1515,7 @@ void LoadLootTemplates_Disenchant() sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty"); - + } void LoadLootTemplates_Fishing() @@ -1541,7 +1541,7 @@ void LoadLootTemplates_Fishing() else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty"); - + } void LoadLootTemplates_Gameobject() @@ -1577,7 +1577,7 @@ void LoadLootTemplates_Gameobject() else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty"); - + } void LoadLootTemplates_Item() @@ -1603,7 +1603,7 @@ void LoadLootTemplates_Item() else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 item loot templates. DB table `item_loot_template` is empty"); - + } void LoadLootTemplates_Milling() @@ -1634,7 +1634,7 @@ void LoadLootTemplates_Milling() else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty"); - + } void LoadLootTemplates_Pickpocketing() @@ -1670,7 +1670,7 @@ void LoadLootTemplates_Pickpocketing() else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty"); - + } void LoadLootTemplates_Prospecting() @@ -1701,7 +1701,7 @@ void LoadLootTemplates_Prospecting() else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty"); - + } void LoadLootTemplates_Mail() @@ -1727,7 +1727,7 @@ void LoadLootTemplates_Mail() else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty"); - + } void LoadLootTemplates_Skinning() @@ -1763,7 +1763,7 @@ void LoadLootTemplates_Skinning() else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty"); - + } void LoadLootTemplates_Spell() @@ -1806,7 +1806,7 @@ void LoadLootTemplates_Spell() sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty"); - + } void LoadLootTemplates_Reference() @@ -1835,5 +1835,5 @@ void LoadLootTemplates_Reference() LootTemplates_Reference.ReportUnusedIds(lootIdSet); sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + } diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp index a23c84b0134..214fd23fc8a 100755 --- a/src/server/game/Movement/Waypoints/WaypointManager.cpp +++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp @@ -49,7 +49,7 @@ void WaypointMgr::Load() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 waypoints. DB table `waypoint_data` is empty!"); - + return; } @@ -87,7 +87,7 @@ void WaypointMgr::Load() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void WaypointMgr::ReloadPath(uint32 id) diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp index 3da3efe4823..5ada88cdf7a 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp @@ -47,7 +47,7 @@ void OutdoorPvPMgr::InitOutdoorPvP() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty."); - + return; } @@ -107,7 +107,7 @@ void OutdoorPvPMgr::InitOutdoorPvP() } sLog->outInfo(LOG_FILTER_OUTDOORPVP, ">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void OutdoorPvPMgr::AddZone(uint32 zoneid, OutdoorPvP* handle) diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 0ce3878db96..f5adf67a9ab 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -257,7 +257,7 @@ void ScriptMgr::Initialize() AddScripts(); sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime)); - + } void ScriptMgr::Unload() diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp index 6337a358866..f24b01306c5 100755 --- a/src/server/game/Scripting/ScriptSystem.cpp +++ b/src/server/game/Scripting/ScriptSystem.cpp @@ -30,14 +30,14 @@ void SystemMgr::LoadScriptTexts() sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Script Texts additional data..."); uint32 oldMSTime = getMSTime(); - + // 0 1 2 3 QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM script_texts"); if (!result) { sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty."); - + return; } @@ -84,7 +84,7 @@ void SystemMgr::LoadScriptTexts() while (result->NextRow()); sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime)); - + } void SystemMgr::LoadScriptTextsCustom() @@ -99,7 +99,7 @@ void SystemMgr::LoadScriptTextsCustom() if (!result) { sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty."); - + return; } @@ -146,7 +146,7 @@ void SystemMgr::LoadScriptTextsCustom() while (result->NextRow()); sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u additional Custom Texts data.", uiCount); - + } void SystemMgr::LoadScriptWaypoints() @@ -171,7 +171,7 @@ void SystemMgr::LoadScriptWaypoints() if (!result) { sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty."); - + return; } @@ -207,5 +207,5 @@ void SystemMgr::LoadScriptWaypoints() while (result->NextRow()); sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp index 96a3538c759..d9cfbe6b69c 100755 --- a/src/server/game/Skills/SkillDiscovery.cpp +++ b/src/server/game/Skills/SkillDiscovery.cpp @@ -56,7 +56,7 @@ void LoadSkillDiscoveryTable() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty."); - + return; } @@ -154,7 +154,7 @@ void LoadSkillDiscoveryTable() } sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player) diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp index 869f5476719..9cb4c145b3d 100755 --- a/src/server/game/Skills/SkillExtraItems.cpp +++ b/src/server/game/Skills/SkillExtraItems.cpp @@ -61,7 +61,7 @@ void LoadSkillExtraItemTable() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty."); - + return; } @@ -111,7 +111,7 @@ void LoadSkillExtraItemTable() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } bool canCreateExtraItems(Player* player, uint32 spellId, float &additionalChance, uint8 &additionalMax) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 2b0e71b4dd8..3cc3a877337 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1156,7 +1156,7 @@ void SpellMgr::LoadSpellRanks() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell rank records. DB table `spell_ranks` is empty."); - + return; } @@ -1252,7 +1252,7 @@ void SpellMgr::LoadSpellRanks() } while (!finished); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellRequired() @@ -1268,7 +1268,7 @@ void SpellMgr::LoadSpellRequired() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell required records. DB table `spell_required` is empty."); - + return; } @@ -1313,7 +1313,7 @@ void SpellMgr::LoadSpellRequired() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellLearnSkills() @@ -1351,7 +1351,7 @@ void SpellMgr::LoadSpellLearnSkills() } sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellLearnSpells() @@ -1365,7 +1365,7 @@ void SpellMgr::LoadSpellLearnSpells() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty."); - + return; } @@ -1454,7 +1454,7 @@ void SpellMgr::LoadSpellLearnSpells() } sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellTargetPositions() @@ -1468,7 +1468,7 @@ void SpellMgr::LoadSpellTargetPositions() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty."); - + return; } @@ -1574,7 +1574,7 @@ void SpellMgr::LoadSpellTargetPositions() }*/ sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellGroups() @@ -1589,7 +1589,7 @@ void SpellMgr::LoadSpellGroups() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell group definitions. DB table `spell_group` is empty."); - + return; } @@ -1656,7 +1656,7 @@ void SpellMgr::LoadSpellGroups() } sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellGroupStackRules() @@ -1670,7 +1670,7 @@ void SpellMgr::LoadSpellGroupStackRules() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty."); - + return; } @@ -1701,7 +1701,7 @@ void SpellMgr::LoadSpellGroupStackRules() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellProcEvents() @@ -1715,7 +1715,7 @@ void SpellMgr::LoadSpellProcEvents() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty."); - + return; } @@ -1765,7 +1765,7 @@ void SpellMgr::LoadSpellProcEvents() sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra and %u custom spell proc event conditions in %u ms", count, customProc, GetMSTimeDiffToNow(oldMSTime)); else sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellProcs() @@ -1779,7 +1779,7 @@ void SpellMgr::LoadSpellProcs() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty."); - + return; } @@ -1906,7 +1906,7 @@ void SpellMgr::LoadSpellProcs() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellBonusess() @@ -1920,7 +1920,7 @@ void SpellMgr::LoadSpellBonusess() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty."); - + return; } @@ -1947,7 +1947,7 @@ void SpellMgr::LoadSpellBonusess() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellThreats() @@ -1961,7 +1961,7 @@ void SpellMgr::LoadSpellThreats() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty."); - + return; } @@ -1988,7 +1988,7 @@ void SpellMgr::LoadSpellThreats() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSkillLineAbilityMap() @@ -2010,7 +2010,7 @@ void SpellMgr::LoadSkillLineAbilityMap() } sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellPetAuras() @@ -2024,7 +2024,7 @@ void SpellMgr::LoadSpellPetAuras() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty."); - + return; } @@ -2072,7 +2072,7 @@ void SpellMgr::LoadSpellPetAuras() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } // Fill custom data about enchancments @@ -2113,7 +2113,7 @@ void SpellMgr::LoadEnchantCustomAttr() } sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellEnchantProcData() @@ -2127,7 +2127,7 @@ void SpellMgr::LoadSpellEnchantProcData() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty."); - + return; } @@ -2157,7 +2157,7 @@ void SpellMgr::LoadSpellEnchantProcData() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellLinked() @@ -2171,7 +2171,7 @@ void SpellMgr::LoadSpellLinked() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty."); - + return; } @@ -2210,7 +2210,7 @@ void SpellMgr::LoadSpellLinked() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadPetLevelupSpellMap() @@ -2267,7 +2267,7 @@ void SpellMgr::LoadPetLevelupSpellMap() } sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime)); - + } bool LoadPetDefaultSpells_helper(CreatureTemplate const* cInfo, PetDefaultSpellsEntry& petDefSpells) @@ -2352,7 +2352,7 @@ void SpellMgr::LoadPetDefaultSpells() } sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Loading summonable creature templates..."); oldMSTime = getMSTime(); @@ -2396,7 +2396,7 @@ void SpellMgr::LoadPetDefaultSpells() } sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellAreas() @@ -2415,7 +2415,7 @@ void SpellMgr::LoadSpellAreas() if (!result) { sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell area requirements. DB table `spell_area` is empty."); - + return; } @@ -2596,7 +2596,7 @@ void SpellMgr::LoadSpellAreas() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadSpellInfoStore() @@ -2613,7 +2613,7 @@ void SpellMgr::LoadSpellInfoStore() } sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::UnloadSpellInfoStore() @@ -2926,7 +2926,7 @@ void SpellMgr::LoadSpellCustomAttr() CreatureAI::FillAISpellInfo(); sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + } void SpellMgr::LoadDbcDataCorrections() @@ -3570,5 +3570,5 @@ void SpellMgr::LoadDbcDataCorrections() properties->Type = SUMMON_TYPE_TOTEM; sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loading spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + } diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp index 32d361faa9a..f64043b7038 100755 --- a/src/server/game/Texts/CreatureTextMgr.cpp +++ b/src/server/game/Texts/CreatureTextMgr.cpp @@ -78,7 +78,7 @@ void CreatureTextMgr::LoadCreatureTexts() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 ceature texts. DB table `creature_texts` is empty."); - + return; } @@ -137,7 +137,7 @@ void CreatureTextMgr::LoadCreatureTexts() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime)); - + } void CreatureTextMgr::LoadCreatureTextLocales() @@ -167,7 +167,7 @@ void CreatureTextMgr::LoadCreatureTextLocales() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature localized texts in %u ms", textCount, GetMSTimeDiffToNow(oldMSTime)); - + } uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisperGuid /*= 0*/, ChatMsg msgType /*= CHAT_MSG_ADDON*/, Language language /*= LANG_ADDON*/, TextRange range /*= TEXT_RANGE_NORMAL*/, uint32 sound /*= 0*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/, Player* srcPlr /*= NULL*/) diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index aedb27a040f..d03ffbbb1f6 100755 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -264,7 +264,7 @@ void TicketMgr::LoadTickets() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!"); - + return; } @@ -291,7 +291,7 @@ void TicketMgr::LoadTickets() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void TicketMgr::LoadSurveys() @@ -304,7 +304,7 @@ void TicketMgr::LoadSurveys() _lastSurveyId = (*result)[0].GetUInt32(); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + } void TicketMgr::AddTicket(GmTicket* ticket) diff --git a/src/server/game/Tools/CharacterDatabaseCleaner.cpp b/src/server/game/Tools/CharacterDatabaseCleaner.cpp index 0619491f364..2bd9a157e73 100644 --- a/src/server/game/Tools/CharacterDatabaseCleaner.cpp +++ b/src/server/game/Tools/CharacterDatabaseCleaner.cpp @@ -64,7 +64,7 @@ void CharacterDatabaseCleaner::CleanDatabase() sWorld->SetCleaningFlags(flags); sLog->outInfo(LOG_FILTER_GENERAL, ">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + } void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table, bool (*check)(uint32)) diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp index 177f373c978..f6daba76c1a 100644 --- a/src/server/game/Warden/WardenCheckMgr.cpp +++ b/src/server/game/Warden/WardenCheckMgr.cpp @@ -44,7 +44,7 @@ void WardenCheckMgr::LoadWardenChecks() if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED)) { sLog->outInfo(LOG_FILTER_WARDEN, ">> Warden disabled, loading checks skipped."); - + return; } @@ -53,7 +53,7 @@ void WardenCheckMgr::LoadWardenChecks() if (!result) { sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded 0 Warden checks. DB table `warden_checks` is empty!"); - + return; } @@ -146,7 +146,7 @@ void WardenCheckMgr::LoadWardenChecks() while (result->NextRow()); sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded %u warden checks.", count); - + } void WardenCheckMgr::LoadWardenOverrides() @@ -155,7 +155,7 @@ void WardenCheckMgr::LoadWardenOverrides() if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED)) { sLog->outInfo(LOG_FILTER_WARDEN, ">> Warden disabled, loading check overrides skipped."); - + return; } @@ -165,7 +165,7 @@ void WardenCheckMgr::LoadWardenOverrides() if (!result) { sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded 0 Warden action overrides. DB table `warden_action` is empty!"); - + return; } @@ -195,7 +195,7 @@ void WardenCheckMgr::LoadWardenOverrides() while (result->NextRow()); sLog->outInfo(LOG_FILTER_WARDEN, ">> Loaded %u warden action overrides.", count); - + } WardenCheck* WardenCheckMgr::GetWardenDataById(uint16 Id) diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp index 150e9f845ec..0e7f1c87b26 100755 --- a/src/server/game/Weather/WeatherMgr.cpp +++ b/src/server/game/Weather/WeatherMgr.cpp @@ -94,7 +94,7 @@ void LoadWeatherData() if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 weather definitions. DB table `game_weather` is empty."); - + return; } @@ -138,7 +138,7 @@ void LoadWeatherData() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } void SendFineWeatherUpdateToPlayer(Player* player) diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 717cfd67ac6..3a13f48d807 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1246,7 +1246,7 @@ void World::SetInitialWorldSettings() sGameEventMgr->Initialize(); ///- Loading strings. Getting no records means core load has to be canceled because no error message can be output. - + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Trinity strings..."); if (!sObjectMgr->LoadTrinityStrings()) exit(1); // Error message displayed in function already @@ -1314,7 +1314,7 @@ void World::SetInitialWorldSettings() sObjectMgr->SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts) sLog->outInfo(LOG_FILTER_GENERAL, ">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime)); - + sLog->outInfo(LOG_FILTER_GENERAL, "Loading Page Texts..."); sObjectMgr->LoadPageTexts(); @@ -1794,7 +1794,7 @@ void World::DetectDBCLang() m_defaultDbcLocale = LocaleConstant(default_locale); sLog->outInfo(LOG_FILTER_GENERAL, "Using %s DBC Locale as default. All available DBC locales: %s", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "" : availableLocalsStr.c_str()); - + } void World::RecordTimeDiff(const char *text, ...) @@ -1834,7 +1834,7 @@ void World::LoadAutobroadcasts() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty!"); - + return; } @@ -1852,7 +1852,7 @@ void World::LoadAutobroadcasts() } while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u autobroadcasts definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } /// Update the World ! @@ -2835,7 +2835,7 @@ void World::LoadWorldStates() if (!result) { sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 world states. DB table `worldstates` is empty!"); - + return; } @@ -2850,7 +2850,7 @@ void World::LoadWorldStates() while (result->NextRow()); sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - + } // Setting a worldstate will save it to DB diff --git a/src/server/shared/AutoPtr.h b/src/server/shared/AutoPtr.h index 988c46cc5a2..19f0680c267 100644 --- a/src/server/shared/AutoPtr.h +++ b/src/server/shared/AutoPtr.h @@ -27,7 +27,7 @@ namespace Trinity { public: AutoPtr() : ACE_Strong_Bound_Ptr() {} - + AutoPtr(Pointer* x) { ACE_Strong_Bound_Ptr::reset(x); diff --git a/src/server/shared/Database/MySQLConnection.cpp b/src/server/shared/Database/MySQLConnection.cpp index 324efab067e..7332cb3ec01 100755 --- a/src/server/shared/Database/MySQLConnection.cpp +++ b/src/server/shared/Database/MySQLConnection.cpp @@ -175,7 +175,7 @@ bool MySQLConnection::Execute(const char* sql) return false; } - else + else sLog->outDebug(LOG_FILTER_SQL, "[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql); } diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index 992554d59aa..c32f51e5a88 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -2,7 +2,7 @@ #define APPENDER_H #include "Define.h" - +#include #include #include diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 6912e841bc3..045c5fd91c8 100755 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -480,12 +480,12 @@ class ByteBuffer { if (!sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) // optimize disabled debug output return; - + uint32 j = 1, k = 1; - + std::ostringstream o; o << "STORAGE_SIZE: " << size(); - + for (uint32 i = 0; i < size(); ++i) { char buf[3]; @@ -501,7 +501,7 @@ class ByteBuffer ++k; ++j; } - + o << buf; } o << " "; -- cgit v1.2.3 From 10891028279762eb14688ec07bc22dffe3b26886 Mon Sep 17 00:00:00 2001 From: Spp Date: Fri, 3 Aug 2012 17:29:43 +0200 Subject: Add missing Copyright headers and some clarification to config files... ¬¬ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/authserver/authserver.conf.dist | 161 ++++++------ src/server/shared/Logging/Appender.cpp | 17 ++ src/server/shared/Logging/Appender.h | 17 ++ src/server/shared/Logging/AppenderConsole.cpp | 17 ++ src/server/shared/Logging/AppenderConsole.h | 17 ++ src/server/shared/Logging/AppenderDB.cpp | 17 ++ src/server/shared/Logging/AppenderDB.h | 17 ++ src/server/shared/Logging/AppenderFile.cpp | 17 ++ src/server/shared/Logging/AppenderFile.h | 17 ++ src/server/shared/Logging/LogOperation.cpp | 17 ++ src/server/shared/Logging/LogOperation.h | 17 ++ src/server/shared/Logging/LogWorker.cpp | 17 ++ src/server/shared/Logging/LogWorker.h | 17 ++ src/server/shared/Logging/Logger.cpp | 17 ++ src/server/shared/Logging/Logger.h | 17 ++ src/server/worldserver/worldserver.conf.dist | 347 +++++++++++++------------- 16 files changed, 497 insertions(+), 249 deletions(-) (limited to 'src/server/shared/Logging') diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index 875d952b14c..93bbc9e3872 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -68,6 +68,89 @@ BindIP = "0.0.0.0" PidFile = "" +# +# UseProcessors +# Description: Processors mask for Windows based multi-processor systems. +# Default: 0 - (Selected by OS) +# 1+ - (Bit mask value of selected processors) + +UseProcessors = 0 + +# +# ProcessPriority +# Description: Process priority setting for Windows based systems. +# Default: 1 - (High) +# 0 - (Normal) + +ProcessPriority = 1 + +# +# RealmsStateUpdateDelay +# Description: Time (in seconds) between realm list updates. +# Default: 20 - (Enabled) +# 0 - (Disabled) + +RealmsStateUpdateDelay = 20 + +# +# WrongPass.MaxCount +# Description: Number of login attemps with wrong password before the account or IP will be +# banned. +# Default: 0 - (Disabled) +# 1+ - (Enabled) + +WrongPass.MaxCount = 0 + +# +# WrongPass.BanTime +# Description: Time (in seconds) for banning account or IP for invalid login attempts. +# Default: 600 - (10 minutes) +# 0 - (Permanent ban) + +WrongPass.BanTime = 600 + +# +# WrongPass.BanType +# Description: Ban type for invalid login attempts. +# Default: 0 - (Ban IP) +# 1 - (Ban Account) + +WrongPass.BanType = 0 + +# +################################################################################################### + +################################################################################################### +# MYSQL SETTINGS +# +# LoginDatabaseInfo +# Description: Database connection settings for the realm server. +# Example: "hostname;port;username;password;database" +# ".;somenumber;username;password;database" - (Use named pipes on Windows +# "enable-named-pipe" to [mysqld] +# section my.ini) +# ".;/path/to/unix_socket;username;password;database" - (use Unix sockets on +# Unix/Linux) +# Default: "127.0.0.1;3306;trinity;trinity;auth" + +LoginDatabaseInfo = "127.0.0.1;3306;trinity;trinity;auth" + +# +# LoginDatabase.WorkerThreads +# Description: The amount of worker threads spawned to handle asynchronous (delayed) MySQL +# statements. Each worker thread is mirrored with its own connection to the +# Default: 1 + +LoginDatabase.WorkerThreads = 1 + +# +################################################################################################### + +################################################################################################### +# +# Logging system options. +# Note: As it uses dynamic option naming, all options related to one appender or logger are grouped. +# # # Appender config values: Given a appender "name" the following options # can be read: @@ -187,81 +270,3 @@ Appender.Auth.Mode=w Logger.root.Type=0 Logger.root.Level=3 Logger.root.Appenders=Console Auth - -# -# UseProcessors -# Description: Processors mask for Windows based multi-processor systems. -# Default: 0 - (Selected by OS) -# 1+ - (Bit mask value of selected processors) - -UseProcessors = 0 - -# -# ProcessPriority -# Description: Process priority setting for Windows based systems. -# Default: 1 - (High) -# 0 - (Normal) - -ProcessPriority = 1 - -# -# RealmsStateUpdateDelay -# Description: Time (in seconds) between realm list updates. -# Default: 20 - (Enabled) -# 0 - (Disabled) - -RealmsStateUpdateDelay = 20 - -# -# WrongPass.MaxCount -# Description: Number of login attemps with wrong password before the account or IP will be -# banned. -# Default: 0 - (Disabled) -# 1+ - (Enabled) - -WrongPass.MaxCount = 0 - -# -# WrongPass.BanTime -# Description: Time (in seconds) for banning account or IP for invalid login attempts. -# Default: 600 - (10 minutes) -# 0 - (Permanent ban) - -WrongPass.BanTime = 600 - -# -# WrongPass.BanType -# Description: Ban type for invalid login attempts. -# Default: 0 - (Ban IP) -# 1 - (Ban Account) - -WrongPass.BanType = 0 - -# -################################################################################################### - -################################################################################################### -# MYSQL SETTINGS -# -# LoginDatabaseInfo -# Description: Database connection settings for the realm server. -# Example: "hostname;port;username;password;database" -# ".;somenumber;username;password;database" - (Use named pipes on Windows -# "enable-named-pipe" to [mysqld] -# section my.ini) -# ".;/path/to/unix_socket;username;password;database" - (use Unix sockets on -# Unix/Linux) -# Default: "127.0.0.1;3306;trinity;trinity;auth" - -LoginDatabaseInfo = "127.0.0.1;3306;trinity;trinity;auth" - -# -# LoginDatabase.WorkerThreads -# Description: The amount of worker threads spawned to handle asynchronous (delayed) MySQL -# statements. Each worker thread is mirrored with its own connection to the -# Default: 1 - -LoginDatabase.WorkerThreads = 1 - -# -################################################################################################### diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index 38d58f1ffb5..0b92e74c1e9 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #include "Appender.h" #include "Common.h" diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index c32f51e5a88..3105f0e6bb4 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #ifndef APPENDER_H #define APPENDER_H diff --git a/src/server/shared/Logging/AppenderConsole.cpp b/src/server/shared/Logging/AppenderConsole.cpp index ad81a883bfa..30c7cc4d135 100644 --- a/src/server/shared/Logging/AppenderConsole.cpp +++ b/src/server/shared/Logging/AppenderConsole.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #include "AppenderConsole.h" #include "Config.h" #include "Util.h" diff --git a/src/server/shared/Logging/AppenderConsole.h b/src/server/shared/Logging/AppenderConsole.h index a9f46cf9c4a..b81fe6dde57 100644 --- a/src/server/shared/Logging/AppenderConsole.h +++ b/src/server/shared/Logging/AppenderConsole.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #ifndef APPENDERCONSOLE_H #define APPENDERCONSOLE_H diff --git a/src/server/shared/Logging/AppenderDB.cpp b/src/server/shared/Logging/AppenderDB.cpp index 6f3737adf4d..63af9176193 100644 --- a/src/server/shared/Logging/AppenderDB.cpp +++ b/src/server/shared/Logging/AppenderDB.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #include "AppenderDB.h" /* FIXME diff --git a/src/server/shared/Logging/AppenderDB.h b/src/server/shared/Logging/AppenderDB.h index ca15fc1a1d5..4399195b181 100644 --- a/src/server/shared/Logging/AppenderDB.h +++ b/src/server/shared/Logging/AppenderDB.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #ifndef APPENDERDB_H #define APPENDERDB_H diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp index 30c1f271c96..93c02913aeb 100644 --- a/src/server/shared/Logging/AppenderFile.cpp +++ b/src/server/shared/Logging/AppenderFile.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #include "AppenderFile.h" #include "Common.h" diff --git a/src/server/shared/Logging/AppenderFile.h b/src/server/shared/Logging/AppenderFile.h index a01ea947334..bbc500f9e76 100644 --- a/src/server/shared/Logging/AppenderFile.h +++ b/src/server/shared/Logging/AppenderFile.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #ifndef APPENDERFILE_H #define APPENDERFILE_H diff --git a/src/server/shared/Logging/LogOperation.cpp b/src/server/shared/Logging/LogOperation.cpp index 59368e519cd..b36dd3a8b1e 100644 --- a/src/server/shared/Logging/LogOperation.cpp +++ b/src/server/shared/Logging/LogOperation.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #include "LogOperation.h" #include "Logger.h" diff --git a/src/server/shared/Logging/LogOperation.h b/src/server/shared/Logging/LogOperation.h index 046ff44e62e..d872670d756 100644 --- a/src/server/shared/Logging/LogOperation.h +++ b/src/server/shared/Logging/LogOperation.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #ifndef LOGOPERATION_H #define LOGOPERATION_H diff --git a/src/server/shared/Logging/LogWorker.cpp b/src/server/shared/Logging/LogWorker.cpp index 4dc71f7f878..a12faaf224c 100644 --- a/src/server/shared/Logging/LogWorker.cpp +++ b/src/server/shared/Logging/LogWorker.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #include "LogWorker.h" LogWorker::LogWorker() diff --git a/src/server/shared/Logging/LogWorker.h b/src/server/shared/Logging/LogWorker.h index fe51be5376c..ea1744f9790 100644 --- a/src/server/shared/Logging/LogWorker.h +++ b/src/server/shared/Logging/LogWorker.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #ifndef LOGWORKER_H #define LOGWORKER_H diff --git a/src/server/shared/Logging/Logger.cpp b/src/server/shared/Logging/Logger.cpp index 7464012c0ac..10276eb3acb 100644 --- a/src/server/shared/Logging/Logger.cpp +++ b/src/server/shared/Logging/Logger.cpp @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #include "Logger.h" Logger::Logger(): name(""), type(LOG_FILTER_GENERAL), level(LOG_LEVEL_DISABLED) diff --git a/src/server/shared/Logging/Logger.h b/src/server/shared/Logging/Logger.h index 10b3991a537..9d13f08620f 100644 --- a/src/server/shared/Logging/Logger.h +++ b/src/server/shared/Logging/Logger.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + #ifndef LOGGER_H #define LOGGER_H diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 01dbd5eaf2d..99cb415dc98 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -403,177 +403,6 @@ PersistentCharacterCleanFlags = 0 PidFile = "" -# -# Appender config values: Given a appender "name" the following options -# can be read: -# -# Appender.name.Type -# Description: Type of appender. Extra appender config options -# will be read depending on this value -# Default: 0 - (None) -# 1 - (Console) -# 2 - (File) -# 3 - (DB) -# -# Appender.name.Level -# Description: Appender level of logging -# Default: 0 - (Disabled) -# 1 - (Trace) -# 2 - (Debug) -# 3 - (Info) -# 4 - (Warn) -# 5 - (Error) -# 6 - (Fatal) -# -# Appender.name.Colors -# Description: Colors for log messages -# (Format: "fatal error warn info debug trace"). -# (Only used with Type = 1) -# Default: "" - no colors -# Colors: 0 - BLACK -# 1 - RED -# 2 - GREEN -# 3 - BROWN -# 4 - BLUE -# 5 - MAGENTA -# 6 - CYAN -# 7 - GREY -# 8 - YELLOW -# 9 - LRED -# 10 - LGREEN -# 11 - LBLUE -# 12 - LMAGENTA -# 13 - LCYAN -# 14 - WHITE -# Example: "13 11 9 5 3 1" -# -# Appender.name.File -# Description: Name of the file -# Allows to use one "%u" to create dynamic files -# (Only used with Type = 2) -# -# Appender.name.Mode -# Description: Mode to open the file -# (Only used with Type = 2) -# Default: a - (Append) -# w - (Overwrite) -# -# Appender.name.Backup -# Description: Make a backup of existing file before overwrite -# (Only used with Mode = w) -# Default: 0 - false -# 1 - true -# -# Appender.name.Timestamp -# Description: Append timestamp to the log file name. -# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext -# (Only used with Type = 2) -# -# Logger config values: Given a logger "name" the following options -# can be read: -# -# Logger.name.Type -# Description: Type of logger. Logs anything related to... -# If no logger with type = 0 exists core will create -# it but disabled. Logger with type = 0 is the -# default one, used when there is no other specific -# logger configured for other logger types -# Default: 0 - Default. Each type that has no config will -# rely on this one. Core will create this logger -# (disabled) if it's not configured -# 1 - Units that doesn't fit in other categories -# 2 - Pets -# 3 - Vehicles -# 4 - C++ AI, instance scripts, etc. -# 5 - DB AI, such as SAI, EAI, CreatureAI -# 6 - DB map scripts -# 7 - Network input/output, -# such as packet handlers and netcode logs -# 8 - Spellsystem and aurasystem -# 9 - Achievement system -# 10 - Condition system -# 11 - Pool system -# 12 - Auction house -# 13 - Arena's and battlegrounds -# 14 - Outdoor PVP -# 15 - Chat system -# 16 - LFG system -# 17 - Maps, instances (not scripts), -# grids, cells, visibility, etc. -# 18 - Player that doesn't fit in other categories. -# 19 - Player loading from DB -# (Player::_LoadXXX functions) -# 20 - Items -# 21 - Player skills (do not confuse with spells) -# 22 - Player chat logs -# 23 - loot -# 24 - guilds -# 25 - transports -# 26 - SQL. DB errors and SQL Driver -# 27 - GM Commands -# 28 - Remote Access Commands -# 29 - Warden -# 30 - Authserver -# 31 - Worldserver -# 32 - Game Events -# 33 - Calendar -# -# Logger.name.Level -# Description: Logger level of logging -# Default: 0 - (Disabled) -# 1 - (Trace) -# 2 - (Debug) -# 3 - (Info) -# 4 - (Warn) -# 5 - (Error) -# 6 - (Fatal) -# -# Logger.name.Appenders -# Description: List of appenders linked to logger -# (Using spaces as separator). - -# -# Appenders -# Description: List of Appenders to read from config -# (Using spaces as separator). -# Default: "Console Server" -# -# Loggers -# Description: List of Loggers to read from config -# (Using spaces as separator). -# Default: "root" - -Loggers=root GM SQL -Appenders=Console Server GM SQL - -Appender.Console.Type=1 -Appender.Console.Level=2 - -Appender.Server.Type=2 -Appender.Server.Level=2 -Appender.Server.File=Server.log -Appender.Server.Mode=w - -Appender.GM.Type=2 -Appender.GM.Level=2 -Appender.GM.File=gm_#%u.log - -Appender.SQL.Type=2 -Appender.SQL.Level=2 -Appender.SQL.File=SQL.log - -Logger.root.Type=0 -Logger.root.Level=3 -Logger.root.Appenders=Console Server - -Logger.SQL.Type=26 -Logger.SQL.Level=3 -Logger.SQL.Appenders=Console Server SQL - -Logger.GM.Type=27 -Logger.GM.Level=3 -Logger.GM.Appenders=Console Server GM - # # ChatLogs.Channel # Description: Log custom channel chat. @@ -648,6 +477,7 @@ ChatLogs.Addon = 0 ChatLogs.BattleGround = 0 +# Extended Logging system configuration moved to end of file (on purpose) # ################################################################################################### @@ -2746,3 +2576,178 @@ PlayerDump.DisallowOverwrite = 1 # ################################################################################################### + +################################################################################################### +# +# Logging system options. +# Note: As it uses dynamic option naming, all options related to one appender or logger are grouped. +# +# +# Appender config values: Given a appender "name" the following options +# can be read: +# +# Appender.name.Type +# Description: Type of appender. Extra appender config options +# will be read depending on this value +# Default: 0 - (None) +# 1 - (Console) +# 2 - (File) +# 3 - (DB) +# +# Appender.name.Level +# Description: Appender level of logging +# Default: 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) +# +# Appender.name.Colors +# Description: Colors for log messages +# (Format: "fatal error warn info debug trace"). +# (Only used with Type = 1) +# Default: "" - no colors +# Colors: 0 - BLACK +# 1 - RED +# 2 - GREEN +# 3 - BROWN +# 4 - BLUE +# 5 - MAGENTA +# 6 - CYAN +# 7 - GREY +# 8 - YELLOW +# 9 - LRED +# 10 - LGREEN +# 11 - LBLUE +# 12 - LMAGENTA +# 13 - LCYAN +# 14 - WHITE +# Example: "13 11 9 5 3 1" +# +# Appender.name.File +# Description: Name of the file +# Allows to use one "%u" to create dynamic files +# (Only used with Type = 2) +# +# Appender.name.Mode +# Description: Mode to open the file +# (Only used with Type = 2) +# Default: a - (Append) +# w - (Overwrite) +# +# Appender.name.Backup +# Description: Make a backup of existing file before overwrite +# (Only used with Mode = w) +# Default: 0 - false +# 1 - true +# +# Appender.name.Timestamp +# Description: Append timestamp to the log file name. +# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext +# (Only used with Type = 2) +# +# Logger config values: Given a logger "name" the following options +# can be read: +# +# Logger.name.Type +# Description: Type of logger. Logs anything related to... +# If no logger with type = 0 exists core will create +# it but disabled. Logger with type = 0 is the +# default one, used when there is no other specific +# logger configured for other logger types +# Default: 0 - Default. Each type that has no config will +# rely on this one. Core will create this logger +# (disabled) if it's not configured +# 1 - Units that doesn't fit in other categories +# 2 - Pets +# 3 - Vehicles +# 4 - C++ AI, instance scripts, etc. +# 5 - DB AI, such as SAI, EAI, CreatureAI +# 6 - DB map scripts +# 7 - Network input/output, +# such as packet handlers and netcode logs +# 8 - Spellsystem and aurasystem +# 9 - Achievement system +# 10 - Condition system +# 11 - Pool system +# 12 - Auction house +# 13 - Arena's and battlegrounds +# 14 - Outdoor PVP +# 15 - Chat system +# 16 - LFG system +# 17 - Maps, instances (not scripts), +# grids, cells, visibility, etc. +# 18 - Player that doesn't fit in other categories. +# 19 - Player loading from DB +# (Player::_LoadXXX functions) +# 20 - Items +# 21 - Player skills (do not confuse with spells) +# 22 - Player chat logs +# 23 - loot +# 24 - guilds +# 25 - transports +# 26 - SQL. DB errors and SQL Driver +# 27 - GM Commands +# 28 - Remote Access Commands +# 29 - Warden +# 30 - Authserver +# 31 - Worldserver +# 32 - Game Events +# 33 - Calendar +# +# Logger.name.Level +# Description: Logger level of logging +# Default: 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) +# +# Logger.name.Appenders +# Description: List of appenders linked to logger +# (Using spaces as separator). +# +# Appenders +# Description: List of Appenders to read from config +# (Using spaces as separator). +# Default: "Console Server" +# +# Loggers +# Description: List of Loggers to read from config +# (Using spaces as separator). +# Default: "root" + +Loggers=root GM SQL +Appenders=Console Server GM SQL + +Appender.Console.Type=1 +Appender.Console.Level=2 + +Appender.Server.Type=2 +Appender.Server.Level=2 +Appender.Server.File=Server.log +Appender.Server.Mode=w + +Appender.GM.Type=2 +Appender.GM.Level=2 +Appender.GM.File=gm_#%u.log + +Appender.SQL.Type=2 +Appender.SQL.Level=2 +Appender.SQL.File=SQL.log + +Logger.root.Type=0 +Logger.root.Level=3 +Logger.root.Appenders=Console Server + +Logger.SQL.Type=26 +Logger.SQL.Level=3 +Logger.SQL.Appenders=Console Server SQL + +Logger.GM.Type=27 +Logger.GM.Level=3 +Logger.GM.Appenders=Console Server GM -- cgit v1.2.3 From af92a36e889d5fc1a7575300e7652d111ccf87d9 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Sat, 4 Aug 2012 02:55:11 +0100 Subject: Core/Logging: Use config LogsDir to save log files (re-added) --- src/server/shared/Logging/AppenderFile.cpp | 5 +++-- src/server/shared/Logging/AppenderFile.h | 3 ++- src/server/shared/Logging/Log.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/server/shared/Logging') diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp index 93c02913aeb..cb875240c46 100644 --- a/src/server/shared/Logging/AppenderFile.cpp +++ b/src/server/shared/Logging/AppenderFile.cpp @@ -18,9 +18,10 @@ #include "AppenderFile.h" #include "Common.h" -AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _mode, bool _backup) +AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _logDir, const char* _mode, bool _backup) : Appender(id, name, APPENDER_FILE, level) , filename(_filename) + , logDir(_logDir) , mode(_mode) , backup(_backup) { @@ -67,5 +68,5 @@ FILE* AppenderFile::OpenFile(std::string const &filename, std::string const &mod newName.append(LogMessage::getTimeStr(time(NULL))); rename(filename.c_str(), newName.c_str()); // no error handling... if we couldn't make a backup, just ignore } - return fopen(filename.c_str(), mode.c_str()); + return fopen((logDir + filename).c_str(), mode.c_str()); } diff --git a/src/server/shared/Logging/AppenderFile.h b/src/server/shared/Logging/AppenderFile.h index bbc500f9e76..8d8b0c43a54 100644 --- a/src/server/shared/Logging/AppenderFile.h +++ b/src/server/shared/Logging/AppenderFile.h @@ -23,7 +23,7 @@ class AppenderFile: public Appender { public: - AppenderFile(uint8 _id, std::string const& _name, LogLevel level, const char* filename, const char* mode, bool backup); + AppenderFile(uint8 _id, std::string const& _name, LogLevel level, const char* filename, const char* logDir, const char* mode, bool backup); ~AppenderFile(); FILE* OpenFile(std::string const& _name, std::string const& _mode, bool _backup); @@ -31,6 +31,7 @@ class AppenderFile: public Appender void _write(LogMessage& message); FILE* logfile; std::string filename; + std::string logDir; std::string mode; bool dynamicName; bool backup; diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 17c6df44125..2ced38847be 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -127,7 +127,7 @@ void Log::CreateAppenderFromConfig(const char* name) } uint8 id = NextAppenderId(); - appenders[id] = new AppenderFile(id, name, level, filename.c_str(), mode.c_str(), backup); + appenders[id] = new AppenderFile(id, name, level, filename.c_str(), m_logsDir.c_str(), mode.c_str(), backup); //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type FILE, Mask %u, File %s, Mode %s\n", name, id, level, filename.c_str(), mode.c_str()); // DEBUG - RemoveMe break; } -- cgit v1.2.3 From 3f42094b9c563d2b2d5f2dfe43d8d47c9114f71f Mon Sep 17 00:00:00 2001 From: Spp Date: Sun, 5 Aug 2012 15:38:25 +0200 Subject: Core/Logging: Add option to remove timestamp, Log Level and Log Filter Type from logged msgs - Appender config option .Timestamp and .Backup became obsolete - New Appender config option .Flags added Appender Console prefixes Log Level and Log Filter Type to the logged text as default Appender File prefixes Timestamp, Log Level and Log Filter Type to the logged text as default --- src/server/authserver/authserver.conf.dist | 19 +++++------ src/server/game/Handlers/CharacterHandler.cpp | 2 +- src/server/game/Server/WorldSession.cpp | 2 +- src/server/shared/Logging/Appender.cpp | 48 ++++++++++++++++++++++++--- src/server/shared/Logging/Appender.h | 21 ++++++++++-- src/server/shared/Logging/AppenderConsole.cpp | 10 +++--- src/server/shared/Logging/AppenderConsole.h | 2 +- src/server/shared/Logging/AppenderFile.cpp | 11 +++--- src/server/shared/Logging/AppenderFile.h | 2 +- src/server/shared/Logging/Log.cpp | 11 +++--- src/server/worldserver/worldserver.conf.dist | 19 +++++------ 11 files changed, 100 insertions(+), 47 deletions(-) (limited to 'src/server/shared/Logging') diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index d77b40e6591..30a319237a6 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -206,16 +206,15 @@ LoginDatabase.WorkerThreads = 1 # Default: a - (Append) # w - (Overwrite) # -# Appender.name.Backup -# Description: Make a backup of existing file before overwrite -# (Only used with Mode = w) -# Default: 0 - false -# 1 - true -# -# Appender.name.Timestamp -# Description: Append timestamp to the log file name. -# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext -# (Only used with Type = 2) +# Appender.name.Flags +# Description: +# Default: Console = 6, File = 7, DB = 0 +# 0 - None +# 1 - Prefix Timestamp to the text +# 2 - Prefix Log Level to the text +# 4 - Prefix Log Filter type to the text +# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2) +# 16 - Make a backup of existing file before overwrite (Only used with Mode = w) # # Logger config values: Given a logger "name" the following options # can be read: diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index df515f879f8..9aecf3c4c25 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -1006,7 +1006,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) SendNotification(LANG_GM_ON); std::string IP_str = GetRemoteAddress(); - sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d", + sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d", GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow(), pCurrChar->getLevel()); if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED)) diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 6e45ebf37c1..6fdbf8a5358 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -534,7 +534,7 @@ void WorldSession::LogoutPlayer(bool Save) // e.g if he got disconnected during a transfer to another map // calls to GetMap in this case may cause crashes _player->CleanupsBeforeDelete(); - sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel()); + sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel()); if (Map* _map = _player->FindMap()) _map->RemovePlayerFromMap(_player, true); diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index 0b92e74c1e9..db7857064df 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -31,8 +31,8 @@ std::string LogMessage::getTimeStr() return getTimeStr(mtime); } -Appender::Appender(uint8 _id, std::string const& _name, AppenderType _type /* = APPENDER_NONE*/, LogLevel _level /* = LOG_LEVEL_DISABLED */): -id(_id), name(_name), type(_type), level(_level) +Appender::Appender(uint8 _id, std::string const& _name, AppenderType _type /* = APPENDER_NONE*/, LogLevel _level /* = LOG_LEVEL_DISABLED */, AppenderFlags _flags /* = APPENDER_FLAGS_NONE */): +id(_id), name(_name), type(_type), level(_level), flags(_flags) { } @@ -60,6 +60,11 @@ LogLevel Appender::getLogLevel() const return level; } +AppenderFlags Appender::getFlags() const +{ + return flags; +} + void Appender::setLogLevel(LogLevel _level) { level = _level; @@ -67,9 +72,40 @@ void Appender::setLogLevel(LogLevel _level) void Appender::write(LogMessage& message) { - if (level && level <= message.level) - _write(message); - //else fprintf(stderr, "Appender::write: Appender %s, Level %s. Msg %s Level %s Type %s WRONG LEVEL MASK\n", getName().c_str(), getLogLevelString(level), message.text.c_str(), getLogLevelString(message.level), getLogFilterTypeString(message.type)); // DEBUG - RemoveMe + if (!level || level > message.level) + { + //fprintf(stderr, "Appender::write: Appender %s, Level %s. Msg %s Level %s Type %s WRONG LEVEL MASK\n", getName().c_str(), getLogLevelString(level), message.text.c_str(), getLogLevelString(message.level), getLogFilterTypeString(message.type)); // DEBUG - RemoveMe + return; + } + + message.prefix.clear(); + if (flags & APPENDER_FLAGS_PREFIX_TIMESTAMP) + message.prefix.append(message.getTimeStr().c_str()); + + if (flags & APPENDER_FLAGS_PREFIX_LOGLEVEL) + { + if (!message.prefix.empty()) + message.prefix.push_back(' '); + + char text[MAX_QUERY_LEN]; + snprintf(text, MAX_QUERY_LEN, "%-5s", Appender::getLogLevelString(message.level)); + message.prefix.append(text); + } + + if (flags & APPENDER_FLAGS_PREFIX_LOGFILTERTYPE) + { + if (!message.prefix.empty()) + message.prefix.push_back(' '); + + char text[MAX_QUERY_LEN]; + snprintf(text, MAX_QUERY_LEN, "[%-15s]", Appender::getLogFilterTypeString(message.type)); + message.prefix.append(text); + } + + if (!message.prefix.empty()) + message.prefix.push_back(' '); + + _write(message); } const char* Appender::getLogLevelString(LogLevel level) @@ -163,6 +199,8 @@ char const* Appender::getLogFilterTypeString(LogFilterType type) return "WORLDSERVER"; case LOG_FILTER_GAMEEVENTS: return "GAMEEVENTS"; + case LOG_FILTER_CALENDAR: + return "CALENDAR"; default: break; } diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index 3105f0e6bb4..429a685d4ee 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -85,9 +85,23 @@ enum AppenderType APPENDER_DB, }; +enum AppenderFlags +{ + APPENDER_FLAGS_NONE = 0x00, + APPENDER_FLAGS_PREFIX_TIMESTAMP = 0x01, + APPENDER_FLAGS_PREFIX_LOGLEVEL = 0x02, + APPENDER_FLAGS_PREFIX_LOGFILTERTYPE = 0x04, + APPENDER_FLAGS_USE_TIMESTAMP = 0x08, // only used by FileAppender + APPENDER_FLAGS_MAKE_FILE_BACKUP = 0x10 // only used by FileAppender +}; + struct LogMessage { - LogMessage(LogLevel _level, LogFilterType _type, std::string _text): level(_level), type(_type), text(_text) + LogMessage(LogLevel _level, LogFilterType _type, std::string _text) + : level(_level) + , type(_type) + , text(_text) + , param1(0) { mtime = time(NULL); } @@ -98,6 +112,7 @@ struct LogMessage LogLevel level; LogFilterType type; std::string text; + std::string prefix; uint32 param1; time_t mtime; }; @@ -105,13 +120,14 @@ struct LogMessage class Appender { public: - Appender(uint8 _id, std::string const& name, AppenderType type = APPENDER_NONE, LogLevel level = LOG_LEVEL_DISABLED); + Appender(uint8 _id, std::string const& name, AppenderType type = APPENDER_NONE, LogLevel level = LOG_LEVEL_DISABLED, AppenderFlags flags = APPENDER_FLAGS_NONE); virtual ~Appender(); uint8 getId() const; std::string const& getName() const; AppenderType getType() const; LogLevel getLogLevel() const; + AppenderFlags getFlags() const; void setLogLevel(LogLevel); void write(LogMessage& message); @@ -125,6 +141,7 @@ class Appender std::string name; AppenderType type; LogLevel level; + AppenderFlags flags; }; typedef std::map AppenderMap; diff --git a/src/server/shared/Logging/AppenderConsole.cpp b/src/server/shared/Logging/AppenderConsole.cpp index 30c7cc4d135..839f8512ad7 100644 --- a/src/server/shared/Logging/AppenderConsole.cpp +++ b/src/server/shared/Logging/AppenderConsole.cpp @@ -21,9 +21,11 @@ #include -AppenderConsole::AppenderConsole(uint8 id, std::string const& name, LogLevel level): -Appender(id, name, APPENDER_CONSOLE, level), _colored(false), _colors() +AppenderConsole::AppenderConsole(uint8 id, std::string const& name, LogLevel level, AppenderFlags flags): +Appender(id, name, APPENDER_CONSOLE, level, flags), _colored(false) { + for (uint8 i = 0; i < MaxLogLevels; ++i) + _colors[i] = ColorTypes(MaxColors); } void AppenderConsole::InitColors(std::string const& str) @@ -183,9 +185,9 @@ void AppenderConsole::_write(LogMessage& message) } SetColor(stdout_stream, _colors[index]); - utf8printf(stdout_stream ? stdout : stderr, "%s %-5s [%-15s] %s", message.getTimeStr().c_str(), Appender::getLogLevelString(message.level), Appender::getLogFilterTypeString(message.type), message.text.c_str()); + utf8printf(stdout_stream ? stdout : stderr, "%s%s", message.prefix.c_str(), message.text.c_str()); ResetColor(stdout_stream); } else - utf8printf(stdout_stream ? stdout : stderr, "%s %-5s [%-15s] %s", message.getTimeStr().c_str(), Appender::getLogLevelString(message.level), Appender::getLogFilterTypeString(message.type), message.text.c_str()); + utf8printf(stdout_stream ? stdout : stderr, "%s%s", message.prefix.c_str(), message.text.c_str()); } diff --git a/src/server/shared/Logging/AppenderConsole.h b/src/server/shared/Logging/AppenderConsole.h index b81fe6dde57..ad7d9543cdb 100644 --- a/src/server/shared/Logging/AppenderConsole.h +++ b/src/server/shared/Logging/AppenderConsole.h @@ -45,7 +45,7 @@ const uint8 MaxColors = uint8(WHITE) + 1; class AppenderConsole: public Appender { public: - AppenderConsole(uint8 _id, std::string const& name, LogLevel level); + AppenderConsole(uint8 _id, std::string const& name, LogLevel level, AppenderFlags flags); void InitColors(const std::string& init_str); private: diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp index cb875240c46..d66771b9055 100644 --- a/src/server/shared/Logging/AppenderFile.cpp +++ b/src/server/shared/Logging/AppenderFile.cpp @@ -18,16 +18,16 @@ #include "AppenderFile.h" #include "Common.h" -AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _logDir, const char* _mode, bool _backup) - : Appender(id, name, APPENDER_FILE, level) +AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _logDir, const char* _mode, AppenderFlags _flags) + : Appender(id, name, APPENDER_FILE, level, _flags) , filename(_filename) , logDir(_logDir) , mode(_mode) - , backup(_backup) { dynamicName = std::string::npos != filename.find("%u"); + backup = _flags & APPENDER_FLAGS_MAKE_FILE_BACKUP; if (!dynamicName) - logfile = OpenFile(_filename, _mode, _backup); + logfile = OpenFile(_filename, _mode, backup); } AppenderFile::~AppenderFile() @@ -50,8 +50,7 @@ void AppenderFile::_write(LogMessage& message) if (logfile) { - fprintf(logfile, "%s %-5s [%-15s] %s", message.getTimeStr().c_str(), Appender::getLogLevelString(message.level), Appender::getLogFilterTypeString(message.type), message.text.c_str()); - + fprintf(logfile, "%s%s", message.prefix.c_str(), message.text.c_str()); fflush(logfile); if (dynamicName) diff --git a/src/server/shared/Logging/AppenderFile.h b/src/server/shared/Logging/AppenderFile.h index 8d8b0c43a54..e9cb858f625 100644 --- a/src/server/shared/Logging/AppenderFile.h +++ b/src/server/shared/Logging/AppenderFile.h @@ -23,7 +23,7 @@ class AppenderFile: public Appender { public: - AppenderFile(uint8 _id, std::string const& _name, LogLevel level, const char* filename, const char* logDir, const char* mode, bool backup); + AppenderFile(uint8 _id, std::string const& _name, LogLevel level, const char* filename, const char* logDir, const char* mode, AppenderFlags flags); ~AppenderFile(); FILE* OpenFile(std::string const& _name, std::string const& _mode, bool _backup); diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 2ced38847be..0bf8bcded86 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -103,7 +103,8 @@ void Log::CreateAppenderFromConfig(const char* name) { case APPENDER_CONSOLE: { - AppenderConsole* appender = new AppenderConsole(NextAppenderId(), name, level); + AppenderFlags flags = AppenderFlags(GetConfigIntDefault(base, "Flags", APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE)); + AppenderConsole* appender = new AppenderConsole(NextAppenderId(), name, level, flags); appenders[appender->getId()] = appender; appender->InitColors(GetConfigStringDefault(base, "Colors", "")); @@ -114,10 +115,9 @@ void Log::CreateAppenderFromConfig(const char* name) { std::string filename = GetConfigStringDefault(base, "File", ""); std::string mode = GetConfigStringDefault(base, "Mode", "a"); - std::string timestamp = GetConfigStringDefault(base, "Timestamp", ""); - bool backup = GetConfigIntDefault(base, "Backup", 0); + AppenderFlags flags = AppenderFlags(GetConfigIntDefault(base, "Flags", APPENDER_FLAGS_PREFIX_TIMESTAMP | APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE)); - if (!timestamp.empty()) + if (flags & APPENDER_FLAGS_USE_TIMESTAMP) { size_t dot_pos = filename.find_last_of("."); if (dot_pos != filename.npos) @@ -127,7 +127,7 @@ void Log::CreateAppenderFromConfig(const char* name) } uint8 id = NextAppenderId(); - appenders[id] = new AppenderFile(id, name, level, filename.c_str(), m_logsDir.c_str(), mode.c_str(), backup); + appenders[id] = new AppenderFile(id, name, level, filename.c_str(), m_logsDir.c_str(), mode.c_str(), flags); //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type FILE, Mask %u, File %s, Mode %s\n", name, id, level, filename.c_str(), mode.c_str()); // DEBUG - RemoveMe break; } @@ -228,7 +228,6 @@ void Log::EnableDBAppenders() for (AppenderMap::iterator it = appenders.begin(); it != appenders.end(); ++it) if (it->second && it->second->getType() == APPENDER_DB) ((AppenderDB *)it->second)->setEnable(true); - } void Log::log(LogFilterType filter, LogLevel level, char const* str, ...) diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 614d7f95eb2..f31326b104a 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2637,16 +2637,15 @@ PlayerDump.DisallowOverwrite = 1 # Default: a - (Append) # w - (Overwrite) # -# Appender.name.Backup -# Description: Make a backup of existing file before overwrite -# (Only used with Mode = w) -# Default: 0 - false -# 1 - true -# -# Appender.name.Timestamp -# Description: Append timestamp to the log file name. -# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext -# (Only used with Type = 2) +# Appender.name.Flags +# Description: +# Default: Console = 6, File = 7, DB = 0 +# 0 - None +# 1 - Prefix Timestamp to the text +# 2 - Prefix Log Level to the text +# 4 - Prefix Log Filter type to the text +# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2) +# 16 - Make a backup of existing file before overwrite (Only used with Mode = w) # # Logger config values: Given a logger "name" the following options # can be read: -- cgit v1.2.3 From 483fb42306b82d92ea4c32ce016dbdd7fa91381d Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 6 Aug 2012 08:49:31 +0200 Subject: Core/Logging: Move player delete logging to new type LOG_FILTER_PLAYER_DELETE (34). Also add missing sql from 55ce180f28 --- sql/updates/world/2012_08_06_00_world_command.sql | 4 ++++ src/server/game/Handlers/CharacterHandler.cpp | 16 ++++++---------- src/server/shared/Logging/Appender.cpp | 2 ++ src/server/shared/Logging/Appender.h | 5 +++-- src/server/worldserver/worldserver.conf.dist | 1 + 5 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 sql/updates/world/2012_08_06_00_world_command.sql (limited to 'src/server/shared/Logging') diff --git a/sql/updates/world/2012_08_06_00_world_command.sql b/sql/updates/world/2012_08_06_00_world_command.sql new file mode 100644 index 00000000000..50628aaa589 --- /dev/null +++ b/sql/updates/world/2012_08_06_00_world_command.sql @@ -0,0 +1,4 @@ +DELETE FROM `command` WHERE `name` IN ('server togglequerylog', 'server set loglevel'); + +INSERT INTO `command` (`name`,`security`,`help`) VALUES +('server set loglevel',4,'Syntax: .server set loglevel $facility $name $loglevel. $facility can take the values: appender (a) or logger (l). $loglevel can take the values: disabled (0), trace (1), debug (2), info (3), warn (4), error (5) or fatal (6)'); diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 9aecf3c4c25..e4926bfad2e 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -687,7 +687,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data) if (sGuildMgr->GetGuildByLeader(guid)) { WorldPacket data(SMSG_CHAR_DELETE, 1); - data << (uint8)CHAR_DELETE_FAILED_GUILD_LEADER; + data << uint8(CHAR_DELETE_FAILED_GUILD_LEADER); SendPacket(&data); return; } @@ -696,18 +696,15 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data) if (sArenaTeamMgr->GetArenaTeamByCaptain(guid)) { WorldPacket data(SMSG_CHAR_DELETE, 1); - data << (uint8)CHAR_DELETE_FAILED_ARENA_CAPTAIN; + data << uint8(CHAR_DELETE_FAILED_ARENA_CAPTAIN); SendPacket(&data); return; } PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_NAME_BY_GUID); - stmt->setUInt32(0, GUID_LOPART(guid)); - PreparedQueryResult result = CharacterDatabase.Query(stmt); - - if (result) + if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) { Field* fields = result->Fetch(); accountId = fields[0].GetUInt32(); @@ -719,22 +716,21 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data) return; std::string IP_str = GetRemoteAddress(); - sLog->outInfo(LOG_FILTER_NETWORKIO, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); sScriptMgr->OnPlayerDelete(guid); sWorld->DeleteCharaceterNameData(GUID_LOPART(guid)); - if (sLog->ShouldLog(LOG_FILTER_PLAYER, LOG_LEVEL_TRACE)) // optimize GetPlayerDump call + if (sLog->ShouldLog(LOG_FILTER_PLAYER_DELETE, LOG_LEVEL_INFO)) // optimize GetPlayerDump call { std::string dump; if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump)) - sLog->outTrace(LOG_FILTER_PLAYER, dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); + sLog->outInfo(LOG_FILTER_PLAYER_DELETE, dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); } Player::DeleteFromDB(guid, GetAccountId()); WorldPacket data(SMSG_CHAR_DELETE, 1); - data << (uint8)CHAR_DELETE_SUCCESS; + data << uint8(CHAR_DELETE_SUCCESS); SendPacket(&data); } diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index db7857064df..abb2649c468 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -201,6 +201,8 @@ char const* Appender::getLogFilterTypeString(LogFilterType type) return "GAMEEVENTS"; case LOG_FILTER_CALENDAR: return "CALENDAR"; + case LOG_FILTER_PLAYER_DELETE: + return "PLAYER_DELETE"; default: break; } diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index 429a685d4ee..323da3f2be8 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -58,10 +58,11 @@ enum LogFilterType LOG_FILTER_AUTHSERVER, LOG_FILTER_WORLDSERVER, LOG_FILTER_GAMEEVENTS, - LOG_FILTER_CALENDAR + LOG_FILTER_CALENDAR, + LOG_FILTER_PLAYER_DELETE }; -const uint8 MaxLogFilter = uint8(LOG_FILTER_CALENDAR) + 1; +const uint8 MaxLogFilter = uint8(LOG_FILTER_PLAYER_DELETE) + 1; // Values assigned have their equivalent in enum ACE_Log_Priority enum LogLevel diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index f31326b104a..3fe9ab4c37e 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2695,6 +2695,7 @@ PlayerDump.DisallowOverwrite = 1 # 31 - Worldserver # 32 - Game Events # 33 - Calendar +# 34 - Player delete # # Logger.name.Level # Description: Logger level of logging -- cgit v1.2.3 From 5746b688fa156f2ea3a72a8f655042c24bdae8c4 Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 6 Aug 2012 09:30:47 +0200 Subject: Core/Logging: Reload Logging options when .reload config is used --- src/server/game/World/World.cpp | 1 + src/server/shared/Logging/Log.cpp | 26 +++++++++++++++----------- src/server/shared/Logging/Log.h | 1 + 3 files changed, 17 insertions(+), 11 deletions(-) (limited to 'src/server/shared/Logging') diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 3a13f48d807..ab3b7150089 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -398,6 +398,7 @@ void World::LoadConfigSettings(bool reload) sLog->outError(LOG_FILTER_GENERAL, "World settings reload fail: can't read settings from %s.", ConfigMgr::GetFilename().c_str()); return; } + sLog->LoadFromConfig(); } ///- Read the player limit and the Message of the day from the config file diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 0bf8bcded86..cce670922f4 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -32,18 +32,8 @@ Log::Log() { SetRealmID(0); - AppenderId = 0; - /// Common log files data - m_logsDir = ConfigMgr::GetStringDefault("LogsDir", ""); - if (!m_logsDir.empty()) - if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\')) - m_logsDir.push_back('/'); - m_logsTimestamp = "_" + GetTimestampStr(); - - ReadAppendersFromConfig(); - ReadLoggersFromConfig(); - worker = new LogWorker(); + LoadFromConfig(); } Log::~Log() @@ -426,6 +416,20 @@ void Log::Close() it->second = NULL; } appenders.clear(); + loggers.clear(); delete worker; worker = NULL; } + +void Log::LoadFromConfig() +{ + Close(); + AppenderId = 0; + m_logsDir = ConfigMgr::GetStringDefault("LogsDir", ""); + if (!m_logsDir.empty()) + if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\')) + m_logsDir.push_back('/'); + ReadAppendersFromConfig(); + ReadLoggersFromConfig(); + worker = new LogWorker(); +} diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h index 5e2b7972dc8..7b0e8cd381b 100755 --- a/src/server/shared/Logging/Log.h +++ b/src/server/shared/Logging/Log.h @@ -40,6 +40,7 @@ class Log ~Log(); public: + void LoadFromConfig(); void Close(); bool ShouldLog(LogFilterType type, LogLevel level) const; bool SetLogLevel(std::string const& name, char const* level, bool isLogger = true); -- cgit v1.2.3 From 97c4b92eb02fc673d1230aadaee23aa7827a9761 Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 6 Aug 2012 12:10:33 +0200 Subject: Core/Logging: Try to simplify configuration of loggers and appenders Changed multiple lines to a simple format: - Logger.name=Type,LogLevel,Flags,AppenderList - Appender.name=Type,LogLevel,Flags,optional1,optional2 * Type = File: optional1 = File name, optiona2 = Mode * Type = Console: optional1 = Colors Created a default set of loggers and appenders. - Root logger defaults to Error, that means you will see nothing on console by default (not even loading) - You need to add the loggers to Loggers options if you want to enable them, otherwise Root logger will be used for all types Restored outSQLDriver (LOG_FILTER_SQL_DRIVER), outSQLDev (LOG_FILTER_SQL_DEV), outArena (LOG_FILTER_ARENA) and outChar (LOG_FILTER_CHARACTER) functionality by creating new types (LOG_FILTER_CHARACTER is a rename of LOG_FILTER_DELETE. Note: You need to update your config file... again (yeah sorry... trying to make it simpler) --- src/server/authserver/authserver.conf.dist | 196 ++++++-------- src/server/game/Battlegrounds/ArenaTeam.cpp | 20 +- src/server/game/Entities/Player/Player.cpp | 76 +++--- src/server/game/Handlers/CharacterHandler.cpp | 15 +- src/server/game/Server/WorldSession.cpp | 2 +- src/server/scripts/Commands/cs_account.cpp | 2 +- src/server/scripts/Commands/cs_debug.cpp | 2 +- src/server/shared/Database/DatabaseWorkerPool.h | 16 +- src/server/shared/Logging/Appender.cpp | 10 +- src/server/shared/Logging/Appender.h | 7 +- src/server/shared/Logging/Log.cpp | 107 ++++++-- src/server/worldserver/worldserver.conf.dist | 337 ++++++++++++------------ 12 files changed, 417 insertions(+), 373 deletions(-) (limited to 'src/server/shared/Logging') diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index 30a319237a6..d1c92dcf1d0 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -149,123 +149,101 @@ LoginDatabase.WorkerThreads = 1 ################################################################################################### # # Logging system options. -# Note: As it uses dynamic option naming, all options related to one appender or logger are grouped. -# -# -# Appender config values: Given a appender "name" the following options -# can be read: -# -# Appender.name.Type -# Description: Type of appender. Extra appender config options -# will be read depending on this value -# Default: 0 - (None) -# 1 - (Console) -# 2 - (File) -# 3 - (DB) -# -# Appender.name.Level -# Description: Appender level of logging -# Default: 0 - (Disabled) -# 1 - (Trace) -# 2 - (Debug) -# 3 - (Info) -# 4 - (Warn) -# 5 - (Error) -# 6 - (Fatal) -# -# Appender.name.Colors -# Description: Colors for log messages -# (Format: "fatal error warn info debug trace"). -# (Only used with Type = 1) -# Default: "" - no colors -# Colors: 0 - BLACK -# 1 - RED -# 2 - GREEN -# 3 - BROWN -# 4 - BLUE -# 5 - MAGENTA -# 6 - CYAN -# 7 - GREY -# 8 - YELLOW -# 9 - LRED -# 10 - LGREEN -# 11 - LBLUE -# 12 - LMAGENTA -# 13 - LCYAN -# 14 - WHITE -# Example: "13 11 9 5 3 1" -# -# Appender.name.File -# Description: Name of the file -# Allows to use one "%u" to create dynamic files -# (Only used with Type = 2) -# -# Appender.name.Mode -# Description: Mode to open the file -# (Only used with Type = 2) -# Default: a - (Append) -# w - (Overwrite) -# -# Appender.name.Flags -# Description: -# Default: Console = 6, File = 7, DB = 0 -# 0 - None -# 1 - Prefix Timestamp to the text -# 2 - Prefix Log Level to the text -# 4 - Prefix Log Filter type to the text -# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2) -# 16 - Make a backup of existing file before overwrite (Only used with Mode = w) -# -# Logger config values: Given a logger "name" the following options -# can be read: -# -# Logger.name.Type -# Description: Type of logger. Logs anything related to... -# If no logger with type = 0 exists core will create -# it but disabled. Logger with type = 0 is the -# default one, used when there is no other specific -# logger configured for other logger types -# Default: 0 - Default. Each type that has no config will -# rely on this one. Core will create this logger -# (disabled) if it's not configured -# 7 - Network input/output, -# 30 - Authserver -# -# Logger.name.Level -# Description: Logger level of logging -# Default: 0 - (Disabled) -# 1 - (Trace) -# 2 - (Debug) -# 3 - (Info) -# 4 - (Warn) -# 5 - (Error) -# 6 - (Fatal) -# -# Logger.name.Appenders -# Description: List of appenders linked to logger +# +# Appender config values: Given a appender "name" +# Appender.name +# Description: Defines 'where to log' +# Format: Type,LogLevel,Flags,optional1,optional2 +# +# Type +# 0 - (None) +# 1 - (Console) +# 2 - (File) +# 3 - (DB) +# +# LogLevel +# 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) +# +# Flags: Default Console = 6, File = 7, DB = 0 +# 0 - None +# 1 - Prefix Timestamp to the text +# 2 - Prefix Log Level to the text +# 4 - Prefix Log Filter type to the text +# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2) +# 16 - Make a backup of existing file before overwrite (Only used with Mode = w) +# +# Colors (read as optional1 if Type = Console) +# Format: "fatal error warn info debug trace" +# 0 - BLACK +# 1 - RED +# 2 - GREEN +# 3 - BROWN +# 4 - BLUE +# 5 - MAGENTA +# 6 - CYAN +# 7 - GREY +# 8 - YELLOW +# 9 - LRED +# 10 - LGREEN +# 11 - LBLUE +# 12 - LMAGENTA +# 13 - LCYAN +# 14 - WHITE +# Example: "13 11 9 5 3 1" +# +# File: Name of the file (read as optional1 if Type = File) +# Allows to use one "%u" to create dynamic files +# +# Mode: Mode to open the file (read as optional2 if Type = File) +# a - (Append) +# w - (Overwrite) +# + +Appender.Console=1,2,6 +Appender.Auth=2,2,7,Auth.log,w + +# Logger config values: Given a logger "name" +# Logger.name +# Description: Defines 'What to log' +# Format: Type,LogLevel,AppenderList +# Type +# 0 - Default. Each type that has no config will +# rely on this one. Core will create this logger +# (disabled) if it's not configured +# 7 - Network input/output, +# 30 - Authserver + +Logger.Root=0,3,Console Auth + +# LogLevel +# 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) +# +# AppenderList: List of appenders linked to logger # (Using spaces as separator). # # Appenders # Description: List of Appenders to read from config # (Using spaces as separator). -# Default: "Console Auth" +# Default: "Console Server" + +Appenders=Console Auth + # # Loggers # Description: List of Loggers to read from config # (Using spaces as separator). # Default: "root" -Loggers=root -Appenders=Console Auth - -Appender.Console.Type=1 -Appender.Console.Level=2 - -Appender.Auth.Type=2 -Appender.Auth.Level=2 -Appender.Auth.File=Auth.log -Appender.Auth.Mode=w - -Logger.root.Type=0 -Logger.root.Level=3 -Logger.root.Appenders=Console Auth +Loggers=Root diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index 7c6cabe37ba..b9ddabcf254 100755 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -87,7 +87,7 @@ bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string teamName, uin // Add captain as member AddMember(CaptainGuid); - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), captainLowGuid); + sLog->outInfo(LOG_FILTER_ARENAS, "New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), captainLowGuid); return true; } @@ -125,7 +125,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid) // Check if player is already in a similar arena team if ((player && player->GetArenaTeamId(GetSlot())) || Player::GetArenaTeamIdFromDB(playerGuid, GetType()) != 0) { - sLog->outError(LOG_FILTER_BATTLEGROUND, "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType()); + sLog->outDebug(LOG_FILTER_ARENAS, "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType()); return false; } @@ -184,7 +184,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid) player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1); } - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId()); + sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId()); return true; } @@ -251,7 +251,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result) if (newMember.Name.empty()) { sLog->outError(LOG_FILTER_SQL, "ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid)); - this->DelMember(newMember.Guid, true); + DelMember(newMember.Guid, true); continue; } @@ -267,7 +267,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result) if (Empty() || !captainPresentInTeam) { // Arena team is empty or captain is not in team, delete from db - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId); + sLog->outDebug(LOG_FILTER_ARENAS, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId); return false; } @@ -297,7 +297,7 @@ void ArenaTeam::SetCaptain(uint64 guid) newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0); char const* oldCaptainName = oldCaptain ? oldCaptain->GetName() : ""; uint32 oldCaptainLowGuid = oldCaptain ? oldCaptain->GetGUIDLow() : 0; - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].", + sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].", oldCaptainName, oldCaptainLowGuid, newCaptain->GetName(), newCaptain->GetGUIDLow(), GetId(), GetType()); } } @@ -321,7 +321,7 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb) // delete all info regarding this team for (uint32 i = 0; i < ARENA_TEAM_END; ++i) player->SetArenaTeamInfoField(GetSlot(), ArenaTeamInfoType(i), 0); - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); + sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); } // Only used for single member deletion, for arena team disband we use a single query for more efficiency @@ -346,7 +346,7 @@ void ArenaTeam::Disband(WorldSession* session) BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName(), GetName(), ""); if (Player* player = session->GetPlayer()) - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); + sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); } // Update database @@ -507,7 +507,7 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCoun data << str1 << str2 << str3; break; default: - sLog->outError(LOG_FILTER_BATTLEGROUND, "Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount); + sLog->outError(LOG_FILTER_ARENAS, "Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount); return; } @@ -529,7 +529,7 @@ uint8 ArenaTeam::GetSlotByType(uint32 type) default: break; } - sLog->outError(LOG_FILTER_BATTLEGROUND, "FATAL: Unknown arena team type %u for some arena team", type); + sLog->outError(LOG_FILTER_ARENAS, "FATAL: Unknown arena team type %u for some arena team", type); return 0xFF; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 2fd80b7b843..0731046892d 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -1228,7 +1228,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount) } // item can't be added - sLog->outError(LOG_FILTER_PLAYER, "STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(), getClass(), msg); + sLog->outError(LOG_FILTER_PLAYER_ITEMS, "STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(), getClass(), msg); return false; } @@ -1534,7 +1534,7 @@ void Player::Update(uint32 p_time) { //sLog->outFatal(LOG_FILTER_PLAYER, "Player has m_pad %u during update!", m_pad); //if (m_spellModTakingSpell) - sLog->outFatal(LOG_FILTER_PLAYER, "Player has m_spellModTakingSpell %u during update!", m_spellModTakingSpell->m_spellInfo->Id); + sLog->outFatal(LOG_FILTER_SPELLS_AURAS, "Player has m_spellModTakingSpell %u during update!", m_spellModTakingSpell->m_spellInfo->Id); m_spellModTakingSpell = NULL; } @@ -1731,7 +1731,7 @@ void Player::Update(uint32 p_time) { // m_nextSave reseted in SaveToDB call SaveToDB(); - sLog->outInfo(LOG_FILTER_PLAYER, "Player '%s' (GUID: %u) saved", GetName(), GetGUIDLow()); + sLog->outDebug(LOG_FILTER_PLAYER, "Player '%s' (GUID: %u) saved", GetName(), GetGUIDLow()); } else m_nextSave -= p_time; @@ -1879,12 +1879,12 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data) PlayerInfo const* info = sObjectMgr->GetPlayerInfo(plrRace, plrClass); if (!info) { - sLog->outError(LOG_FILTER_PLAYER, "Player %u has incorrect race/class pair. Don't build enum.", guid); + sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player %u has incorrect race/class pair. Don't build enum.", guid); return false; } else if (!IsValidGender(gender)) { - sLog->outError(LOG_FILTER_PLAYER, "Player (%u) has incorrect gender (%hu), don't build enum.", guid, gender); + sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player (%u) has incorrect gender (%hu), don't build enum.", guid, gender); return false; } @@ -2066,14 +2066,14 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati { if (!MapManager::IsValidMapCoord(mapid, x, y, z, orientation)) { - sLog->outError(LOG_FILTER_PLAYER, "TeleportTo: invalid map (%d) or invalid coordinates (X: %f, Y: %f, Z: %f, O: %f) given when teleporting player (GUID: %u, name: %s, map: %d, X: %f, Y: %f, Z: %f, O: %f).", + sLog->outError(LOG_FILTER_MAPS, "TeleportTo: invalid map (%d) or invalid coordinates (X: %f, Y: %f, Z: %f, O: %f) given when teleporting player (GUID: %u, name: %s, map: %d, X: %f, Y: %f, Z: %f, O: %f).", mapid, x, y, z, orientation, GetGUIDLow(), GetName(), GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); return false; } if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, mapid, this)) { - sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName(), mapid); + sLog->outError(LOG_FILTER_MAPS, "Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName(), mapid); SendTransferAborted(mapid, TRANSFER_ABORT_MAP_NOT_ALLOWED); return false; } @@ -2426,7 +2426,7 @@ void Player::RemoveFromWorld() { if (WorldObject* viewpoint = GetViewpoint()) { - sLog->outFatal(LOG_FILTER_PLAYER, "Player %s has viewpoint %u %u when removed from world", GetName(), viewpoint->GetEntry(), viewpoint->GetTypeId()); + sLog->outError(LOG_FILTER_PLAYER, "Player %s has viewpoint %u %u when removed from world", GetName(), viewpoint->GetEntry(), viewpoint->GetTypeId()); SetViewpoint(viewpoint, false); } } @@ -3355,7 +3355,7 @@ void Player::SendInitialSpells() GetSession()->SendPacket(&data); - sLog->outInfo(LOG_FILTER_PLAYER, "CHARACTER: Sent Initial Spells"); + sLog->outDebug(LOG_FILTER_NETWORKIO, "CHARACTER: Sent Initial Spells"); } void Player::RemoveMail(uint32 id) @@ -3436,7 +3436,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) // do character spell book cleanup (all characters) if (!IsInWorld() && !learning) // spell load case { - sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL); @@ -3445,7 +3445,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) CharacterDatabase.Execute(stmt); } else - sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); return false; } @@ -3455,7 +3455,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) // do character spell book cleanup (all characters) if (!IsInWorld() && !learning) // spell load case { - sLog->outError(LOG_FILTER_PLAYER, "Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spellId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL); @@ -3464,7 +3464,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning) CharacterDatabase.Execute(stmt); } else - sLog->outError(LOG_FILTER_PLAYER, "Player::addTalent: Broken spell #%u learning not allowed.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addTalent: Broken spell #%u learning not allowed.", spellId); return false; } @@ -3509,7 +3509,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent // do character spell book cleanup (all characters) if (!IsInWorld() && !learning) // spell load case { - sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL); @@ -3518,7 +3518,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent CharacterDatabase.Execute(stmt); } else - sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId); return false; } @@ -3528,7 +3528,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent // do character spell book cleanup (all characters) if (!IsInWorld() && !learning) // spell load case { - sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spellId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL); @@ -3537,7 +3537,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent CharacterDatabase.Execute(stmt); } else - sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Broken spell #%u learning not allowed.", spellId); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Broken spell #%u learning not allowed.", spellId); return false; } @@ -4291,7 +4291,7 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result) if (!sSpellMgr->GetSpellInfo(spell_id)) { - sLog->outError(LOG_FILTER_PLAYER, "Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id); + sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id); continue; } @@ -5003,7 +5003,7 @@ void Player::DeleteOldCharacters(uint32 keepDays) if (result) { - sLog->outInfo(LOG_FILTER_PLAYER, "Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount()); + sLog->outDebug(LOG_FILTER_PLAYER, "Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount()); do { Field* fields = result->Fetch(); @@ -5418,7 +5418,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel); if (!dcost) { - sLog->outError(LOG_FILTER_PLAYER, "RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel); + sLog->outError(LOG_FILTER_PLAYER_ITEMS, "RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel); return TotalCost; } @@ -5426,7 +5426,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g DurabilityQualityEntry const* dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId); if (!dQualitymodEntry) { - sLog->outError(LOG_FILTER_PLAYER, "RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId); + sLog->outError(LOG_FILTER_PLAYER_ITEMS, "RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId); return TotalCost; } @@ -5442,7 +5442,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g { if (GetGuildId() == 0) { - sLog->outDebug(LOG_FILTER_PLAYER, "You are not member of a guild"); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "You are not member of a guild"); return TotalCost; } @@ -5457,7 +5457,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g } else if (!HasEnoughMoney(costs)) { - sLog->outDebug(LOG_FILTER_PLAYER, "You do not have enough money"); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "You do not have enough money"); return TotalCost; } else @@ -5665,7 +5665,7 @@ void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, floa { if (modGroup >= BASEMOD_END || modType >= MOD_END) { - sLog->outError(LOG_FILTER_PLAYER, "ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!"); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!"); return; } @@ -5696,7 +5696,7 @@ float Player::GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const { if (modGroup >= BASEMOD_END || modType > MOD_END) { - sLog->outError(LOG_FILTER_PLAYER, "trial to access non existed BaseModGroup or wrong BaseModType!"); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "trial to access non existed BaseModGroup or wrong BaseModType!"); return 0.0f; } @@ -5710,7 +5710,7 @@ float Player::GetTotalBaseModValue(BaseModGroup modGroup) const { if (modGroup >= BASEMOD_END) { - sLog->outError(LOG_FILTER_PLAYER, "wrong BaseModGroup in GetTotalBaseModValue()!"); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "wrong BaseModGroup in GetTotalBaseModValue()!"); return 0.0f; } @@ -6432,7 +6432,7 @@ void Player::SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal) SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(id); if (!pSkill) { - sLog->outError(LOG_FILTER_PLAYER, "Skill not found in SkillLineStore: skill #%u", id); + sLog->outError(LOG_FILTER_PLAYER_SKILLS, "Skill not found in SkillLineStore: skill #%u", id); return; } @@ -6592,8 +6592,6 @@ int16 Player::GetSkillTempBonusValue(uint32 skill) const void Player::SendActionButtons(uint32 state) const { - sLog->outInfo(LOG_FILTER_PLAYER, "Sending Action Buttons for '%u' spec '%u'", GetGUIDLow(), m_activeSpec); - WorldPacket data(SMSG_ACTION_BUTTONS, 1+(MAX_ACTION_BUTTONS*4)); data << uint8(state); /* @@ -6615,20 +6613,20 @@ void Player::SendActionButtons(uint32 state) const } GetSession()->SendPacket(&data); - sLog->outInfo(LOG_FILTER_PLAYER, "Action Buttons for '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec); + sLog->outInfo(LOG_FILTER_NETWORKIO, "SMSG_ACTION_BUTTONS sent '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec); } bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) { if (button >= MAX_ACTION_BUTTONS) { - sLog->outError(LOG_FILTER_PLAYER, "Action %u not added into button %u for player %s: button must be < %u", action, button, GetName(), MAX_ACTION_BUTTONS); + sLog->outError(LOG_FILTER_PLAYER_LOADING, "Action %u not added into button %u for player %s: button must be < %u", action, button, GetName(), MAX_ACTION_BUTTONS); return false; } if (action >= MAX_ACTION_BUTTON_ACTION_VALUE) { - sLog->outError(LOG_FILTER_PLAYER, "Action %u not added into button %u for player %s: action must be < %u", action, button, GetName(), MAX_ACTION_BUTTON_ACTION_VALUE); + sLog->outError(LOG_FILTER_PLAYER_LOADING, "Action %u not added into button %u for player %s: action must be < %u", action, button, GetName(), MAX_ACTION_BUTTON_ACTION_VALUE); return false; } @@ -6637,7 +6635,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) case ACTION_BUTTON_SPELL: if (!sSpellMgr->GetSpellInfo(action)) { - sLog->outError(LOG_FILTER_PLAYER, "Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName()); + sLog->outError(LOG_FILTER_PLAYER_LOADING, "Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName()); return false; } @@ -6650,7 +6648,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) case ACTION_BUTTON_ITEM: if (!sObjectMgr->GetItemTemplate(action)) { - sLog->outError(LOG_FILTER_PLAYER, "Item action %u not added into button %u for player %s: item not exist", action, button, GetName()); + sLog->outError(LOG_FILTER_PLAYER_LOADING, "Item action %u not added into button %u for player %s: item not exist", action, button, GetName()); return false; } break; @@ -6672,7 +6670,7 @@ ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type) // set data and update to CHANGED if not NEW ab.SetActionAndType(action, ActionButtonType(type)); - sLog->outInfo(LOG_FILTER_PLAYER, "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button); + sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button); return &ab; } @@ -6687,7 +6685,7 @@ void Player::removeActionButton(uint8 button) else buttonItr->second.uState = ACTIONBUTTON_DELETED; // saved, will deleted at next save - sLog->outInfo(LOG_FILTER_PLAYER, "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow()); + sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow()); } ActionButton const* Player::GetActionButton(uint8 button) @@ -7698,7 +7696,7 @@ void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply) if (item->IsBroken()) return; - sLog->outInfo(LOG_FILTER_PLAYER, "applying mods for item %u ", item->GetGUIDLow()); + sLog->outInfo(LOG_FILTER_PLAYER_ITEMS, "applying mods for item %u ", item->GetGUIDLow()); uint8 attacktype = Player::GetAttackBySlot(slot); @@ -8290,7 +8288,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId); if (!spellInfo) { - sLog->outError(LOG_FILTER_PLAYER, "WORLD: unknown Item spellid %i", spellData.SpellId); + sLog->outError(LOG_FILTER_PLAYER_ITEMS, "WORLD: unknown Item spellid %i", spellData.SpellId); continue; } @@ -8359,7 +8357,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]); if (!spellInfo) { - sLog->outError(LOG_FILTER_PLAYER, "Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...", + sLog->outError(LOG_FILTER_PLAYER_ITEMS, "Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...", GetGUIDLow(), GetName(), pEnchant->ID, pEnchant->spellid[s]); continue; } diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index e4926bfad2e..7451bd2dc2a 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -658,8 +658,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte SendPacket(&data); std::string IP_str = GetRemoteAddress(); - sLog->outInfo(LOG_FILTER_NETWORKIO, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); - sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); sScriptMgr->OnPlayerCreate(&newChar); sWorld->AddCharacterNameData(newChar.GetGUIDLow(), std::string(newChar.GetName()), newChar.getGender(), newChar.getRace(), newChar.getClass()); @@ -716,15 +715,15 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data) return; std::string IP_str = GetRemoteAddress(); - sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); sScriptMgr->OnPlayerDelete(guid); sWorld->DeleteCharaceterNameData(GUID_LOPART(guid)); - if (sLog->ShouldLog(LOG_FILTER_PLAYER_DELETE, LOG_LEVEL_INFO)) // optimize GetPlayerDump call + if (sLog->ShouldLog(LOG_FILTER_CHARACTER, LOG_LEVEL_DEBUG)) // optimize GetPlayerDump call { std::string dump; if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump)) - sLog->outInfo(LOG_FILTER_PLAYER_DELETE, dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); + sLog->outDebug(LOG_FILTER_CHARACTER, dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); } Player::DeleteFromDB(guid, GetAccountId()); @@ -1002,7 +1001,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) SendNotification(LANG_GM_ON); std::string IP_str = GetRemoteAddress(); - sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d", + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d", GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow(), pCurrChar->getLevel()); if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED)) @@ -1179,7 +1178,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu CharacterDatabase.Execute(stmt); - sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str()); + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str()); WorldPacket data(SMSG_CHAR_RENAME, 1+8+(newName.size()+1)); data << uint8(RESPONSE_SUCCESS); @@ -1446,7 +1445,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) if (result) { std::string oldname = result->Fetch()[0].GetString(); - sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str()); + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str()); } Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair); diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 6fdbf8a5358..118b0d68d5d 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -534,7 +534,7 @@ void WorldSession::LogoutPlayer(bool Save) // e.g if he got disconnected during a transfer to another map // calls to GetMap in this case may cause crashes _player->CleanupsBeforeDelete(); - sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel()); + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel()); if (Map* _map = _player->FindMap()) _map->RemovePlayerFromMap(_player, true); diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index db975419a23..1024a3acf15 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -111,7 +111,7 @@ public: handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName); if (handler->GetSession()) { - sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password." + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password." , handler->GetSession()->GetAccountId(),handler->GetSession()->GetRemoteAddress().c_str() , handler->GetSession()->GetPlayer()->GetName(), handler->GetSession()->GetPlayer()->GetGUIDLow()); } diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 355ff195cf5..7f25a11bcdd 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -1325,7 +1325,7 @@ public: { Player* player = handler->GetSession()->GetPlayer(); - sLog->outInfo(LOG_FILTER_SQL, "(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); + sLog->outInfo(LOG_FILTER_SQL_DEV, "(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); handler->PSendSysMessage("Waypoint SQL written to SQL Developer log"); return true; diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index d86b99a062a..9d6fabb9dfa 100755 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -64,7 +64,7 @@ class DatabaseWorkerPool bool res = true; _connectionInfo = MySQLConnectionInfo(infoString); - sLog->outWarn(LOG_FILTER_SQL, "Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.", + sLog->outInfo(LOG_FILTER_SQL_DRIVER, "Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.", GetDatabaseName(), async_threads, synch_threads); //! Open asynchronous connections (delayed operations) @@ -88,17 +88,17 @@ class DatabaseWorkerPool } if (res) - sLog->outWarn(LOG_FILTER_SQL, "DatabasePool '%s' opened successfully. %u total connections running.", GetDatabaseName(), + sLog->outInfo(LOG_FILTER_SQL_DRIVER, "DatabasePool '%s' opened successfully. %u total connections running.", GetDatabaseName(), (_connectionCount[IDX_SYNCH] + _connectionCount[IDX_ASYNC])); else - sLog->outError(LOG_FILTER_SQL, "DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile " + sLog->outError(LOG_FILTER_SQL_DRIVER, "DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile " "for specific errors.", GetDatabaseName()); return res; } void Close() { - sLog->outWarn(LOG_FILTER_SQL, "Closing down DatabasePool '%s'.", GetDatabaseName()); + sLog->outInfo(LOG_FILTER_SQL_DRIVER, "Closing down DatabasePool '%s'.", GetDatabaseName()); //! Shuts down delaythreads for this connection pool by underlying deactivate(). //! The next dequeue attempt in the worker thread tasks will result in an error, @@ -114,7 +114,7 @@ class DatabaseWorkerPool t->Close(); //! Closes the actualy MySQL connection. } - sLog->outWarn(LOG_FILTER_SQL, "Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.", + sLog->outInfo(LOG_FILTER_SQL_DRIVER, "Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.", GetDatabaseName()); //! Shut down the synchronous connections @@ -127,7 +127,7 @@ class DatabaseWorkerPool //! Deletes the ACE_Activation_Queue object and its underlying ACE_Message_Queue delete _queue; - sLog->outWarn(LOG_FILTER_SQL, "All connections on DatabasePool '%s' closed.", GetDatabaseName()); + sLog->outInfo(LOG_FILTER_SQL_DRIVER, "All connections on DatabasePool '%s' closed.", GetDatabaseName()); } /** @@ -351,10 +351,10 @@ class DatabaseWorkerPool switch (transaction->GetSize()) { case 0: - sLog->outWarn(LOG_FILTER_SQL, "Transaction contains 0 queries. Not executing."); + sLog->outDebug(LOG_FILTER_SQL_DRIVER, "Transaction contains 0 queries. Not executing."); return; case 1: - sLog->outWarn(LOG_FILTER_SQL, "Warning: Transaction only holds 1 query, consider removing Transaction context in code."); + sLog->outDebug(LOG_FILTER_SQL_DRIVER, "Warning: Transaction only holds 1 query, consider removing Transaction context in code."); break; default: break; diff --git a/src/server/shared/Logging/Appender.cpp b/src/server/shared/Logging/Appender.cpp index abb2649c468..be30a54ff02 100644 --- a/src/server/shared/Logging/Appender.cpp +++ b/src/server/shared/Logging/Appender.cpp @@ -201,8 +201,14 @@ char const* Appender::getLogFilterTypeString(LogFilterType type) return "GAMEEVENTS"; case LOG_FILTER_CALENDAR: return "CALENDAR"; - case LOG_FILTER_PLAYER_DELETE: - return "PLAYER_DELETE"; + case LOG_FILTER_CHARACTER: + return "CHARACTER"; + case LOG_FILTER_ARENAS: + return "ARENAS"; + case LOG_FILTER_SQL_DRIVER: + return "SQL DRIVER"; + case LOG_FILTER_SQL_DEV: + return "SQL DEV"; default: break; } diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index 323da3f2be8..7d7375a1edb 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -59,10 +59,13 @@ enum LogFilterType LOG_FILTER_WORLDSERVER, LOG_FILTER_GAMEEVENTS, LOG_FILTER_CALENDAR, - LOG_FILTER_PLAYER_DELETE + LOG_FILTER_CHARACTER, + LOG_FILTER_ARENAS, + LOG_FILTER_SQL_DRIVER, + LOG_FILTER_SQL_DEV }; -const uint8 MaxLogFilter = uint8(LOG_FILTER_PLAYER_DELETE) + 1; +const uint8 MaxLogFilter = uint8(LOG_FILTER_SQL_DEV) + 1; // Values assigned have their equivalent in enum ACE_Log_Priority enum LogLevel diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index cce670922f4..c9ba159cdea 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -19,7 +19,7 @@ #include "Log.h" #include "Common.h" #include "Config.h" - +#include "Util.h" #include "AppenderConsole.h" #include "AppenderFile.h" #include "AppenderDB.h" @@ -82,30 +82,66 @@ void Log::CreateAppenderFromConfig(const char* name) if (!name || *name == '\0') return; - std::string base = "Appender."; - base.append(name); - base.push_back('.'); + // Format=type,level,flags,optional1,optional2 + // if type = File. optional1 = file and option2 = mode + // if type = Console. optional1 = Color + std::string options = "Appender."; + options.append(name); + options = ConfigMgr::GetStringDefault(options.c_str(), ""); + Tokens tokens(options, ','); + Tokens::iterator iter = tokens.begin(); + + if (tokens.size() < 2) + { + fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong configuration for appender %s. Config line: %s\n", name, options.c_str()); + return; + } - LogLevel level = LogLevel(GetConfigIntDefault(base, "Level", 0)); - AppenderType type = AppenderType(GetConfigIntDefault(base, "Type", 0)); + AppenderFlags flags = APPENDER_FLAGS_NONE; + AppenderType type = AppenderType(atoi(*iter)); + ++iter; + LogLevel level = LogLevel(atoi(*iter)); + if (level > LOG_LEVEL_FATAL) + { + fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong Log Level %u for appender %s\n", level, name); + return; + } - switch(type) + if (++iter != tokens.end()) + flags = AppenderFlags(atoi(*iter)); + + switch (type) { case APPENDER_CONSOLE: { - AppenderFlags flags = AppenderFlags(GetConfigIntDefault(base, "Flags", APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE)); + if (flags == APPENDER_FLAGS_NONE) + flags = AppenderFlags(APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE); + AppenderConsole* appender = new AppenderConsole(NextAppenderId(), name, level, flags); appenders[appender->getId()] = appender; - - appender->InitColors(GetConfigStringDefault(base, "Colors", "")); + if (++iter != tokens.end()) + appender->InitColors(*iter); //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type CONSOLE, Mask %u\n", appender->getName().c_str(), appender->getId(), appender->getLogLevel()); // DEBUG - RemoveMe break; } case APPENDER_FILE: { - std::string filename = GetConfigStringDefault(base, "File", ""); - std::string mode = GetConfigStringDefault(base, "Mode", "a"); - AppenderFlags flags = AppenderFlags(GetConfigIntDefault(base, "Flags", APPENDER_FLAGS_PREFIX_TIMESTAMP | APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE)); + std::string filename; + std::string mode = "a"; + + if (++iter == tokens.end()) + { + fprintf(stderr, "Log::CreateAppenderFromConfig: Missing file name for appender %s\n", name); + return; + } + + if (flags == APPENDER_FLAGS_NONE) + flags = AppenderFlags(APPENDER_FLAGS_PREFIX_LOGLEVEL | APPENDER_FLAGS_PREFIX_LOGFILTERTYPE | APPENDER_FLAGS_PREFIX_TIMESTAMP); + + filename = *iter; + + if (++iter != tokens.end()) + mode = *iter; if (flags & APPENDER_FLAGS_USE_TIMESTAMP) { @@ -121,13 +157,14 @@ void Log::CreateAppenderFromConfig(const char* name) //fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type FILE, Mask %u, File %s, Mode %s\n", name, id, level, filename.c_str(), mode.c_str()); // DEBUG - RemoveMe break; } - case APPENDER_DB: // TODO Set realm! + case APPENDER_DB: { uint8 id = NextAppenderId(); appenders[id] = new AppenderDB(id, name, level, realm); break; } default: + fprintf(stderr, "Log::CreateAppenderFromConfig: Unknown type %u for appender %s\n", type, name); break; } } @@ -137,29 +174,49 @@ void Log::CreateLoggerFromConfig(const char* name) if (!name || *name == '\0') return; - std::string base = "Logger."; - base.append(name); - base.push_back('.'); + LogLevel level = LOG_LEVEL_DISABLED; + int32 type = -1; - LogLevel level = LogLevel(GetConfigIntDefault(base, "Level", 0)); - int32 type = GetConfigIntDefault(base, "Type", -1); + std::string options = "Logger."; + options.append(name); + options = ConfigMgr::GetStringDefault(options.c_str(), ""); - if (type < 0) + Tokens tokens(options, ','); + Tokens::iterator iter = tokens.begin(); + + if (tokens.size() != 3) { - fprintf(stderr, "Log::CreateLoggerFromConfig: Missing entry %sType in config. Logger ignored\n", name); + fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong configuration for logger %s. Config line: %s\n", name, options.c_str()); return; } - Logger& logger = loggers[type]; + type = atoi(*iter); + if (type > MaxLogFilter) + { + fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong type %u for logger %s\n", type, name); + return; + } + Logger& logger = loggers[type]; if (!logger.getName().empty()) - fprintf(stderr, "Error while configuring Logger %s. Replacing (name: %s, Type: %u, Level: %u) with (name: %s, Type: %u, Level: %u)\n", - name, logger.getName().c_str(), logger.getType(), logger.getLogLevel(), name, type, level); + { + fprintf(stderr, "Error while configuring Logger %s. Already defined\n", name); + return; + } + + ++iter; + level = LogLevel(atoi(*iter)); + if (level > LOG_LEVEL_FATAL) + { + fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong Log Level %u for logger %s\n", type, name); + return; + } logger.Create(name, LogFilterType(type), level); //fprintf(stdout, "Log::CreateLoggerFromConfig: Created Logger %s, Type %u, mask %u\n", name, LogFilterType(type), level); // DEBUG - RemoveMe - std::istringstream ss(GetConfigStringDefault(base, "Appenders", "")); + ++iter; + std::istringstream ss(*iter); std::string str; ss >> str; diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 3fe9ab4c37e..be5a452c7b4 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -1148,15 +1148,6 @@ Warden.NumMemChecks = 3 Warden.NumOtherChecks = 7 -# -# Warden.LogFile -# Description: Client check fails will be logged here. -# Default: "" - (Disabled) -# "Warden.log" - (Enabled) -# - -Warden.LogFile = "" - # # Warden.ClientResponseDelay # Description: Time (in seconds) before client is getting disconnecting for not responding. @@ -2580,174 +2571,186 @@ PlayerDump.DisallowOverwrite = 1 ################################################################################################### # # Logging system options. -# Note: As it uses dynamic option naming, all options related to one appender or logger are grouped. -# # -# Appender config values: Given a appender "name" the following options -# can be read: -# -# Appender.name.Type -# Description: Type of appender. Extra appender config options -# will be read depending on this value -# Default: 0 - (None) -# 1 - (Console) -# 2 - (File) -# 3 - (DB) -# -# Appender.name.Level -# Description: Appender level of logging -# Default: 0 - (Disabled) -# 1 - (Trace) -# 2 - (Debug) -# 3 - (Info) -# 4 - (Warn) -# 5 - (Error) -# 6 - (Fatal) -# -# Appender.name.Colors -# Description: Colors for log messages -# (Format: "fatal error warn info debug trace"). -# (Only used with Type = 1) -# Default: "" - no colors -# Colors: 0 - BLACK -# 1 - RED -# 2 - GREEN -# 3 - BROWN -# 4 - BLUE -# 5 - MAGENTA -# 6 - CYAN -# 7 - GREY -# 8 - YELLOW -# 9 - LRED -# 10 - LGREEN -# 11 - LBLUE -# 12 - LMAGENTA -# 13 - LCYAN -# 14 - WHITE -# Example: "13 11 9 5 3 1" -# -# Appender.name.File -# Description: Name of the file -# Allows to use one "%u" to create dynamic files -# (Only used with Type = 2) -# -# Appender.name.Mode -# Description: Mode to open the file -# (Only used with Type = 2) -# Default: a - (Append) -# w - (Overwrite) -# -# Appender.name.Flags -# Description: -# Default: Console = 6, File = 7, DB = 0 -# 0 - None -# 1 - Prefix Timestamp to the text -# 2 - Prefix Log Level to the text -# 4 - Prefix Log Filter type to the text -# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2) -# 16 - Make a backup of existing file before overwrite (Only used with Mode = w) -# -# Logger config values: Given a logger "name" the following options -# can be read: -# -# Logger.name.Type -# Description: Type of logger. Logs anything related to... -# If no logger with type = 0 exists core will create -# it but disabled. Logger with type = 0 is the -# default one, used when there is no other specific -# logger configured for other logger types -# Default: 0 - Default. Each type that has no config will -# rely on this one. Core will create this logger -# (disabled) if it's not configured -# 1 - Units that doesn't fit in other categories -# 2 - Pets -# 3 - Vehicles -# 4 - C++ AI, instance scripts, etc. -# 5 - DB AI, such as SAI, EAI, CreatureAI -# 6 - DB map scripts -# 7 - Network input/output, -# such as packet handlers and netcode logs -# 8 - Spellsystem and aurasystem -# 9 - Achievement system -# 10 - Condition system -# 11 - Pool system -# 12 - Auction house -# 13 - Arena's and battlegrounds -# 14 - Outdoor PVP -# 15 - Chat system -# 16 - LFG system -# 17 - Maps, instances (not scripts), -# grids, cells, visibility, etc. -# 18 - Player that doesn't fit in other categories. -# 19 - Player loading from DB -# (Player::_LoadXXX functions) -# 20 - Items -# 21 - Player skills (do not confuse with spells) -# 22 - Player chat logs -# 23 - loot -# 24 - guilds -# 25 - transports -# 26 - SQL. DB errors and SQL Driver -# 27 - GM Commands -# 28 - Remote Access Commands -# 29 - Warden -# 30 - Authserver -# 31 - Worldserver -# 32 - Game Events -# 33 - Calendar -# 34 - Player delete -# -# Logger.name.Level -# Description: Logger level of logging -# Default: 0 - (Disabled) -# 1 - (Trace) -# 2 - (Debug) -# 3 - (Info) -# 4 - (Warn) -# 5 - (Error) -# 6 - (Fatal) -# -# Logger.name.Appenders -# Description: List of appenders linked to logger +# Appender config values: Given a appender "name" +# Appender.name +# Description: Defines 'where to log' +# Format: Type,LogLevel,Flags,optional1,optional2 +# +# Type +# 0 - (None) +# 1 - (Console) +# 2 - (File) +# 3 - (DB) +# +# LogLevel +# 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) +# +# Flags: Default Console = 6, File = 7, DB = 0 +# 0 - None +# 1 - Prefix Timestamp to the text +# 2 - Prefix Log Level to the text +# 4 - Prefix Log Filter type to the text +# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2) +# 16 - Make a backup of existing file before overwrite (Only used with Mode = w) +# +# Colors (read as optional1 if Type = Console) +# Format: "fatal error warn info debug trace" +# 0 - BLACK +# 1 - RED +# 2 - GREEN +# 3 - BROWN +# 4 - BLUE +# 5 - MAGENTA +# 6 - CYAN +# 7 - GREY +# 8 - YELLOW +# 9 - LRED +# 10 - LGREEN +# 11 - LBLUE +# 12 - LMAGENTA +# 13 - LCYAN +# 14 - WHITE +# Example: "13 11 9 5 3 1" +# +# File: Name of the file (read as optional1 if Type = File) +# Allows to use one "%u" to create dynamic files +# +# Mode: Mode to open the file (read as optional2 if Type = File) +# a - (Append) +# w - (Overwrite) +# + +Appender.Console=1,2,6 +Appender.Server=2,2,7,Server.log,w +Appender.GM=2,2,7,GM.log +Appender.SQL=2,2,7,SQL.log +Appender.DBErrors=2,2,7,DBErrors.log +Appender.Char=2,2,7,Char.log,w +Appender.RA=2,2,7,RA.log +Appender.Arenas=2,2,7,Arena.log +Appender.SQLDev=2,2,7,SQLDev.log +Appender.SQLDriver=2,2,7,SQLDriver.log +Appender.Warden=2,2,7,Warden.log +Appender.Chat=2,2,7,Chat.log + +# Logger config values: Given a logger "name" +# Logger.name +# Description: Defines 'What to log' +# Format: Type,LogLevel,AppenderList +# Type +# 0 - Default. Each type that has no config will +# rely on this one. Core will create this logger +# (disabled) if it's not configured +# 1 - Units that doesn't fit in other categories +# 2 - Pets +# 3 - Vehicles +# 4 - C++ AI, instance scripts, etc. +# 5 - DB AI, such as SAI, EAI, CreatureAI +# 6 - DB map scripts +# 7 - Network input/output, +# such as packet handlers and netcode logs +# 8 - Spellsystem and aurasystem +# 9 - Achievement system +# 10 - Condition system +# 11 - Pool system +# 12 - Auction house +# 13 - Arena's and battlegrounds +# 14 - Outdoor PVP +# 15 - Chat system +# 16 - LFG system +# 17 - Maps, instances (not scripts), +# grids, cells, visibility, etc. +# 18 - Player that doesn't fit in other categories. +# 19 - Player loading from DB +# (Player::_LoadXXX functions) +# 20 - Items +# 21 - Player skills (do not confuse with spells) +# 22 - Player chat logs +# 23 - loot +# 24 - guilds +# 25 - transports +# 26 - SQL. DB errors +# 27 - GM Commands +# 28 - Remote Access Commands +# 29 - Warden +# 30 - Authserver +# 31 - Worldserver +# 32 - Game Events +# 33 - Calendar +# 34 - Character (Exclusive to log login, logout, create, rename, delete actions) +# 35 - Arenas +# 36 - SQL Driver +# 37 - SQL Dev + +Logger.Root=0,5,Console Server +Logger.Units=1,3,Console Server +Logger.Pets=2,3,Console Server +Logger.Vehicles=3,3,Console Server +Logger.TCSR=4,3,Console Server +Logger.AI=5,3,Console Server +Logger.MapScripts=6,3,Console Server +Logger.NetWork=7,3,Console Server +Logger.Spells=8,3,Console Server +Logger.Achievements=9,3,Console Server +Logger.Conditions=10,3,Console Server +Logger.Pool=11,3,Console Server +Logger.AuctionHouse=12,3,Console Server +Logger.Battlegrounds=13,3,Console Server +Logger.OutdoorPvP=14,3,Console Server +Logger.ChatSystem=15,3,Console Server +Logger.LFG=16,3,Console Server +Logger.Maps=17,3,Console Server +Logger.Player=18,3,Console Server +Logger.PlayerLoading=19,3,Console Server +Logger.PlayerItems=20,3,Console Server +Logger.PlayerSkills=21,3,Console Server +Logger.PlayerChat=22,3,Chat +Logger.Loot=23,3,Console Server +Logger.Guilds=24,3,Console Server +Logger.Transports=25,3,Console Server +Logger.SQL=26,2,Console Server SQL +Logger.GM=27,3,Console Server GM +Logger.RA=28,3,RA +Logger.Warden=29,3,Warden +Logger.Authserver=30,3,Console Server +Logger.Worldserver=31,3,Console Server +Logger.GameEvents=32,3,Console Server +Logger.Calendar=33,3,Console Server +Logger.Character=34,3,Char +Logger.Arenas=35,3,Arenas +Logger.SQLDriver=36,5,SQLDriver +Logger.SQLDev=37,3,SQLDev + +# LogLevel +# 0 - (Disabled) +# 1 - (Trace) +# 2 - (Debug) +# 3 - (Info) +# 4 - (Warn) +# 5 - (Error) +# 6 - (Fatal) +# +# AppenderList: List of appenders linked to logger # (Using spaces as separator). # # Appenders # Description: List of Appenders to read from config # (Using spaces as separator). # Default: "Console Server" + +Appenders=Console Server + # # Loggers # Description: List of Loggers to read from config # (Using spaces as separator). # Default: "root" -Loggers=root GM SQL -Appenders=Console Server GM SQL - -Appender.Console.Type=1 -Appender.Console.Level=2 - -Appender.Server.Type=2 -Appender.Server.Level=2 -Appender.Server.File=Server.log -Appender.Server.Mode=w - -Appender.GM.Type=2 -Appender.GM.Level=2 -Appender.GM.File=gm_#%u.log - -Appender.SQL.Type=2 -Appender.SQL.Level=2 -Appender.SQL.File=SQL.log - -Logger.root.Type=0 -Logger.root.Level=3 -Logger.root.Appenders=Console Server - -Logger.SQL.Type=26 -Logger.SQL.Level=3 -Logger.SQL.Appenders=Console Server SQL - -Logger.GM.Type=27 -Logger.GM.Level=3 -Logger.GM.Appenders=Console Server GM +Loggers=Root -- cgit v1.2.3 From 6d21515939388c5f24e3954880a21bea10c35173 Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 6 Aug 2012 13:20:24 +0200 Subject: Core/Logging: Implement logging to database --- sql/updates/auth/2012_08_06_00_auth_logs.sql | 2 ++ src/server/shared/Logging/AppenderDB.cpp | 27 +++++++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) create mode 100644 sql/updates/auth/2012_08_06_00_auth_logs.sql (limited to 'src/server/shared/Logging') diff --git a/sql/updates/auth/2012_08_06_00_auth_logs.sql b/sql/updates/auth/2012_08_06_00_auth_logs.sql new file mode 100644 index 00000000000..04e90e7d208 --- /dev/null +++ b/sql/updates/auth/2012_08_06_00_auth_logs.sql @@ -0,0 +1,2 @@ +ALTER TABLE `logs` ADD COLUMN `level` TINYINT(3) UNSIGNED NOT NULL DEFAULT 0 AFTER `type`; + diff --git a/src/server/shared/Logging/AppenderDB.cpp b/src/server/shared/Logging/AppenderDB.cpp index 63af9176193..0254ec72bd0 100644 --- a/src/server/shared/Logging/AppenderDB.cpp +++ b/src/server/shared/Logging/AppenderDB.cpp @@ -16,12 +16,7 @@ */ #include "AppenderDB.h" - -/* FIXME -#include "DatabaseWorkerPool.h" -#include "Implementation/LoginDatabase.h" // For logging -extern DatabaseWorkerPool LoginDatabase; -*/ +#include "Database/DatabaseEnv.h" AppenderDB::AppenderDB(uint8 id, std::string const& name, LogLevel level, uint8 realmId): Appender(id, name, APPENDER_DB, level), realm(realmId), enable(false) @@ -32,13 +27,21 @@ AppenderDB::~AppenderDB() { } -void AppenderDB::_write(LogMessage& /*message*/) +void AppenderDB::_write(LogMessage& message) { -/* FIXME - if (enable) - LoginDatabase.PExecute("INSERT INTO logs (time, realm, type, severity, string) " - "VALUES (" UI64FMTD ", %u, %u, '%s');", message.mtime, realm, message.type, message.level, message.text.c_str()); -*/ + if (!enable) + return; + switch (message.type) + { + case LOG_FILTER_SQL: + case LOG_FILTER_SQL_DRIVER: + case LOG_FILTER_SQL_DEV: + break; // Avoid infinite loop, PExecute triggers Logging with LOG_FILTER_SQL type + default: + LoginDatabase.PExecute("INSERT INTO logs (time, realm, type, level, string) " + "VALUES (" UI64FMTD ", %u, %u, %u, '%s');", message.mtime, realm, message.type, message.level, message.text.c_str()); + break; + } } void AppenderDB::setEnable(bool _enable) -- cgit v1.2.3 From 4a5a077b655664e2daa98dfe3e7e781605734027 Mon Sep 17 00:00:00 2001 From: Spp Date: Mon, 6 Aug 2012 13:36:34 +0200 Subject: Core/Logging: Use prepared statements in AppenderDB --- src/server/shared/Database/Implementation/LoginDatabase.cpp | 2 +- src/server/shared/Logging/AppenderDB.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src/server/shared/Logging') diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp index 028d927a720..31d9f5ec1f6 100755 --- a/src/server/shared/Database/Implementation/LoginDatabase.cpp +++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp @@ -59,7 +59,7 @@ void LoginDatabaseConnection::DoPrepareStatements() PREPARE_STATEMENT(LOGIN_INS_REALM_CHARACTERS_INIT, "INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist, account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_EXPANSION, "UPDATE account SET expansion = ? WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_ACCOUNT_LOCK, "UPDATE account SET locked = ? WHERE id = ?", CONNECTION_ASYNC); - PREPARE_STATEMENT(LOGIN_INS_LOG, "INSERT INTO logs (time, realm, type, string) VALUES (UNIX_TIMESTAMP(), ? , ?, ?)", CONNECTION_ASYNC); + PREPARE_STATEMENT(LOGIN_INS_LOG, "INSERT INTO logs (time, realm, type, level, string) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_USERNAME, "UPDATE account SET v = 0, s = 0, username = ?, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_PASSWORD, "UPDATE account SET v = 0, s = 0, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC); PREPARE_STATEMENT(LOGIN_UPD_MUTE_TIME, "UPDATE account SET mutetime = ? WHERE id = ?", CONNECTION_ASYNC); diff --git a/src/server/shared/Logging/AppenderDB.cpp b/src/server/shared/Logging/AppenderDB.cpp index 0254ec72bd0..8836be2b24a 100644 --- a/src/server/shared/Logging/AppenderDB.cpp +++ b/src/server/shared/Logging/AppenderDB.cpp @@ -37,9 +37,14 @@ void AppenderDB::_write(LogMessage& message) case LOG_FILTER_SQL_DRIVER: case LOG_FILTER_SQL_DEV: break; // Avoid infinite loop, PExecute triggers Logging with LOG_FILTER_SQL type - default: - LoginDatabase.PExecute("INSERT INTO logs (time, realm, type, level, string) " - "VALUES (" UI64FMTD ", %u, %u, %u, '%s');", message.mtime, realm, message.type, message.level, message.text.c_str()); + default: + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(LOGIN_INS_LOG); + stmt->setUInt64(0, message.mtime); + stmt->setUInt32(1, realm); + stmt->setUInt8(2, message.type); + stmt->setUInt8(3, message.level); + stmt->setString(4, message.text); + LoginDatabase.Execute(stmt); break; } } -- cgit v1.2.3 From 5aa54ca0e97b48194376e504ad5d2b91cc8abdd1 Mon Sep 17 00:00:00 2001 From: kandera Date: Mon, 6 Aug 2012 13:02:11 -0300 Subject: Update src/server/shared/Logging/AppenderDB.cpp Core/Appender: fix typo --- src/server/shared/Logging/AppenderDB.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/server/shared/Logging') diff --git a/src/server/shared/Logging/AppenderDB.cpp b/src/server/shared/Logging/AppenderDB.cpp index 8836be2b24a..76abfca2d85 100644 --- a/src/server/shared/Logging/AppenderDB.cpp +++ b/src/server/shared/Logging/AppenderDB.cpp @@ -38,7 +38,7 @@ void AppenderDB::_write(LogMessage& message) case LOG_FILTER_SQL_DEV: break; // Avoid infinite loop, PExecute triggers Logging with LOG_FILTER_SQL type default: - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(LOGIN_INS_LOG); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_LOG); stmt->setUInt64(0, message.mtime); stmt->setUInt32(1, realm); stmt->setUInt8(2, message.type); -- cgit v1.2.3 From 429130522e223c8a5cd80d6e23fda4cc30ce5132 Mon Sep 17 00:00:00 2001 From: Nay Date: Tue, 7 Aug 2012 04:21:58 +0200 Subject: Core/Authserver: Fix logging crash at startup --- src/server/shared/Logging/Log.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/server/shared/Logging') diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index c9ba159cdea..1dca5e71006 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -29,7 +29,7 @@ #include #include -Log::Log() +Log::Log() : worker(NULL) { SetRealmID(0); m_logsTimestamp = "_" + GetTimestampStr(); -- cgit v1.2.3