diff options
author | Spp <spp@jorge.gr> | 2012-08-03 14:20:18 +0200 |
---|---|---|
committer | Spp <spp@jorge.gr> | 2012-08-03 14:20:18 +0200 |
commit | 55ce180f2867700b28921d99f9a0cb9c83330c91 (patch) | |
tree | c563db507cce44b680996d42148185cb1512188c /src/server/game/Conditions/DisableMgr.cpp | |
parent | f85908869986eab0b645f0a697028bcceba7778c (diff) |
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
Diffstat (limited to 'src/server/game/Conditions/DisableMgr.cpp')
-rwxr-xr-x | src/server/game/Conditions/DisableMgr.cpp | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp index d7a769d3f5c..99a492a224e 100755 --- a/src/server/game/Conditions/DisableMgr.cpp +++ b/src/server/game/Conditions/DisableMgr.cpp @@ -59,8 +59,8 @@ void LoadDisables() if (!result) { - sLog->outString(">> Loaded 0 disables. DB table `disables` is empty!"); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 disables. DB table `disables` is empty!"); + return; } @@ -71,7 +71,7 @@ void LoadDisables() DisableType type = DisableType(fields[0].GetUInt32()); if (type >= MAX_DISABLE_TYPES) { - sLog->outErrorDb("Invalid type %u specified in `disables` table, skipped.", type); + sLog->outError(LOG_FILTER_SQL, "Invalid type %u specified in `disables` table, skipped.", type); continue; } @@ -88,13 +88,13 @@ void LoadDisables() case DISABLE_TYPE_SPELL: if (!(sSpellMgr->GetSpellInfo(entry) || flags & SPELL_DISABLE_DEPRECATED_SPELL)) { - sLog->outErrorDb("Spell entry %u from `disables` doesn't exist in dbc, skipped.", entry); + sLog->outError(LOG_FILTER_SQL, "Spell entry %u from `disables` doesn't exist in dbc, skipped.", entry); continue; } if (!flags || flags > MAX_SPELL_DISABLE_TYPE) { - sLog->outErrorDb("Disable flags for spell %u are invalid, skipped.", entry); + sLog->outError(LOG_FILTER_SQL, "Disable flags for spell %u are invalid, skipped.", entry); continue; } @@ -121,7 +121,7 @@ void LoadDisables() MapEntry const* mapEntry = sMapStore.LookupEntry(entry); if (!mapEntry) { - sLog->outErrorDb("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry); + sLog->outError(LOG_FILTER_SQL, "Map entry %u from `disables` doesn't exist in dbc, skipped.", entry); continue; } bool isFlagInvalid = false; @@ -142,12 +142,12 @@ void LoadDisables() break; case MAP_BATTLEGROUND: case MAP_ARENA: - sLog->outErrorDb("Battleground map %u specified to be disabled in map case, skipped.", entry); + sLog->outError(LOG_FILTER_SQL, "Battleground map %u specified to be disabled in map case, skipped.", entry); continue; } if (isFlagInvalid) { - sLog->outErrorDb("Disable flags for map %u are invalid, skipped.", entry); + sLog->outError(LOG_FILTER_SQL, "Disable flags for map %u are invalid, skipped.", entry); continue; } break; @@ -155,64 +155,64 @@ void LoadDisables() case DISABLE_TYPE_BATTLEGROUND: if (!sBattlemasterListStore.LookupEntry(entry)) { - sLog->outErrorDb("Battleground entry %u from `disables` doesn't exist in dbc, skipped.", entry); + sLog->outError(LOG_FILTER_SQL, "Battleground entry %u from `disables` doesn't exist in dbc, skipped.", entry); continue; } if (flags) - sLog->outErrorDb("Disable flags specified for battleground %u, useless data.", entry); + sLog->outError(LOG_FILTER_SQL, "Disable flags specified for battleground %u, useless data.", entry); break; case DISABLE_TYPE_OUTDOORPVP: if (entry > MAX_OUTDOORPVP_TYPES) { - sLog->outErrorDb("OutdoorPvPTypes value %u from `disables` is invalid, skipped.", entry); + sLog->outError(LOG_FILTER_SQL, "OutdoorPvPTypes value %u from `disables` is invalid, skipped.", entry); continue; } if (flags) - sLog->outErrorDb("Disable flags specified for outdoor PvP %u, useless data.", entry); + sLog->outError(LOG_FILTER_SQL, "Disable flags specified for outdoor PvP %u, useless data.", entry); break; case DISABLE_TYPE_ACHIEVEMENT_CRITERIA: if (!sAchievementCriteriaStore.LookupEntry(entry)) { - sLog->outErrorDb("Achievement Criteria entry %u from `disables` doesn't exist in dbc, skipped.", entry); + sLog->outError(LOG_FILTER_SQL, "Achievement Criteria entry %u from `disables` doesn't exist in dbc, skipped.", entry); continue; } if (flags) - sLog->outErrorDb("Disable flags specified for Achievement Criteria %u, useless data.", entry); + sLog->outError(LOG_FILTER_SQL, "Disable flags specified for Achievement Criteria %u, useless data.", entry); break; case DISABLE_TYPE_VMAP: { MapEntry const* mapEntry = sMapStore.LookupEntry(entry); if (!mapEntry) { - sLog->outErrorDb("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry); + sLog->outError(LOG_FILTER_SQL, "Map entry %u from `disables` doesn't exist in dbc, skipped.", entry); continue; } switch (mapEntry->map_type) { case MAP_COMMON: if (flags & VMAP_DISABLE_AREAFLAG) - sLog->outString("Areaflag disabled for world map %u.", entry); + sLog->outInfo(LOG_FILTER_GENERAL, "Areaflag disabled for world map %u.", entry); if (flags & VMAP_DISABLE_LIQUIDSTATUS) - sLog->outString("Liquid status disabled for world map %u.", entry); + sLog->outInfo(LOG_FILTER_GENERAL, "Liquid status disabled for world map %u.", entry); break; case MAP_INSTANCE: case MAP_RAID: if (flags & VMAP_DISABLE_HEIGHT) - sLog->outString("Height disabled for instance map %u.", entry); + sLog->outInfo(LOG_FILTER_GENERAL, "Height disabled for instance map %u.", entry); if (flags & VMAP_DISABLE_LOS) - sLog->outString("LoS disabled for instance map %u.", entry); + sLog->outInfo(LOG_FILTER_GENERAL, "LoS disabled for instance map %u.", entry); break; case MAP_BATTLEGROUND: if (flags & VMAP_DISABLE_HEIGHT) - sLog->outString("Height disabled for battleground map %u.", entry); + sLog->outInfo(LOG_FILTER_GENERAL, "Height disabled for battleground map %u.", entry); if (flags & VMAP_DISABLE_LOS) - sLog->outString("LoS disabled for battleground map %u.", entry); + sLog->outInfo(LOG_FILTER_GENERAL, "LoS disabled for battleground map %u.", entry); break; case MAP_ARENA: if (flags & VMAP_DISABLE_HEIGHT) - sLog->outString("Height disabled for arena map %u.", entry); + sLog->outInfo(LOG_FILTER_GENERAL, "Height disabled for arena map %u.", entry); if (flags & VMAP_DISABLE_LOS) - sLog->outString("LoS disabled for arena map %u.", entry); + sLog->outInfo(LOG_FILTER_GENERAL, "LoS disabled for arena map %u.", entry); break; default: break; @@ -228,8 +228,8 @@ void LoadDisables() } while (result->NextRow()); - sLog->outString(">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime)); + } void CheckQuestDisables() @@ -239,8 +239,8 @@ void CheckQuestDisables() uint32 count = m_DisableMap[DISABLE_TYPE_QUEST].size(); if (!count) { - sLog->outString(">> Checked 0 quest disables."); - sLog->outString(); + sLog->outInfo(LOG_FILTER_GENERAL, ">> Checked 0 quest disables."); + return; } @@ -250,17 +250,17 @@ void CheckQuestDisables() const uint32 entry = itr->first; if (!sObjectMgr->GetQuestTemplate(entry)) { - sLog->outErrorDb("Quest entry %u from `disables` doesn't exist, skipped.", entry); + sLog->outError(LOG_FILTER_SQL, "Quest entry %u from `disables` doesn't exist, skipped.", entry); m_DisableMap[DISABLE_TYPE_QUEST].erase(itr++); continue; } if (itr->second.flags) - sLog->outErrorDb("Disable flags specified for quest %u, useless data.", entry); + sLog->outError(LOG_FILTER_SQL, "Disable flags specified for quest %u, useless data.", entry); ++itr; } - sLog->outString(">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + 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) |