ManaPlus
|
#include <logger.h>
Public Member Functions | |
Logger () | |
~Logger () | |
void | setLogFile (const std::string &logFilename) |
void | setLogToStandardOut (const bool value) |
void | log (const char *const log_text,...) |
void | assertLog (const char *const log_text,...) |
void | log_r (const char *const log_text,...) |
void | log1 (const char *const log_text) |
void | log (const std::string &str) |
void | flush () |
void | dlog (const std::string &str) |
void | dlog2 (const std::string &str, const int pos, const char *const comment) |
void | closeFile () |
void | setDebugLog (const bool n) |
void | setReportUnimplemented (const bool n) |
void | error (const std::string &error_text) __attribute__((noreturn)) |
void | safeError (const std::string &error_text) __attribute__((noreturn)) |
void | unimplemented (const int id) |
void | unimplemented (const int id, const int id2) |
void | unimplemented (const uint32_t id, const uint32_t id2, const uint32_t id3) const |
FILE * | getFile () const |
Private Attributes | |
FILE * | mLogFile |
std::vector< std::string > | mDelayedLog |
SDL_mutex * | mMutex |
volatile bool | mThreadLocked |
bool | mLogToStandardOut |
bool | mDebugLog |
bool | mReportUnimplemented |
Logger::Logger | ( | ) |
Logger::~Logger | ( | ) |
Destructor, closes log file.
Definition at line 105 of file logger.cpp.
References closeFile(), and mMutex.
void Logger::assertLog | ( | const char *const | log_text, |
... | |||
) |
Enters a message in the log. The message will be timestamped.
Definition at line 316 of file logger.cpp.
References CAST_SIZE, CAST_U32, DATESTREAM, Settings::disableLoggingInGame, DebugMessageListener::distributeEvent(), mLogFile, mLogToStandardOut, settings, EmoteDB::size(), and SPECIALLOG.
Referenced by compareSDLVersions(), compareVersions(), EventsManager::logEvent(), VirtFs::FsDir::rwops_seek(), VirtFs::FsZip::rwops_seek(), and WhoIsOnline::slowLogic().
void Logger::closeFile | ( | ) |
Definition at line 111 of file logger.cpp.
References mLogFile.
Referenced by setLogFile(), and ~Logger().
void Logger::dlog | ( | const std::string & | str | ) |
Enters debug message in the log. The message will be timestamped.
Definition at line 148 of file logger.cpp.
References DATESTREAM, DSPECIALLOG, mDebugLog, mLogFile, and mLogToStandardOut.
Referenced by LocalPlayer::fixPos(), and Net::MessageIn::readBytes().
void Logger::dlog2 | ( | const std::string & | str, |
const int | pos, | ||
const char *const | comment | ||
) |
Definition at line 178 of file logger.cpp.
References DATESTREAM, DSPECIALLOG, mDebugLog, mLogFile, and mLogToStandardOut.
void Logger::error | ( | const std::string & | error_text | ) |
Log an error and quit. The error will pop-up on Windows and Mac, and will be printed to standard error everywhere else.
Definition at line 472 of file logger.cpp.
References log(), and Actions::msg().
Referenced by Font::Font(), Client::gameInit(), Dirs::initConfigDir(), Dirs::initLocalDataDir(), ConfigManager::initServerConfig(), Dirs::initTempDir(), Dirs::initUsersDir(), ModernOpenGLGraphics::postInit(), and GraphicsManager::setVideoMode().
void Logger::flush | ( | ) |
Definition at line 418 of file logger.cpp.
References FOR_EACH, mDelayedLog, mLogFile, mMutex, and mThreadLocked.
Referenced by Gui::slowLogic().
FILE * Logger::getFile | ( | ) | const |
Definition at line 552 of file logger.cpp.
References mLogFile.
Referenced by Net::Download::addCommonFlags().
void Logger::log | ( | const char *const | log_text, |
... | |||
) |
Enters a message in the log. The message will be timestamped.
Definition at line 269 of file logger.cpp.
References CAST_SIZE, CAST_U32, DATESTREAM, Settings::disableLoggingInGame, mLogFile, mLogToStandardOut, settings, EmoteDB::size(), and SPECIALLOG.
Referenced by ChangeEmailDialog::action(), ChangePasswordDialog::action(), RegisterDialog::action(), Map::addAnimation(), Particle::addEffect(), ParticleEngine::addEffect(), Map::addExtraLayer(), MapReader::addLayerToList(), ResourceManager::addResource(), applyEffectByOption(), applyEffectByOption1(), ConfigManager::backupConfig(), ModernOpenGLGraphics::bindElementBuffer(), GettextHelper::bindTextDomain(), SafeOpenGLImageHelper::bindTexture(), ResourceManager::cleanUp(), Joystick::close(), Ea::Network::connect(), AtlasManager::convertAtlas(), AtlasManager::convertEmptyAtlas(), SDLInput::convertMouseButton(), SafeOpenGLImageHelper::convertSurface(), SafeOpenGLImageHelper::convertSurfaceNormalize(), EAthena::BeingRecv::createBeing2(), ShadersManager::createProgram(), AtlasManager::createSDLAtlas(), ShadersManager::createShader(), GraphicsManager::createTextureSampler(), debugCallback(), Resource::decRef(), ResourceManager::deleteInstance(), ResourceManager::deleteResourceManager(), destroyGuiWindows(), Cpu::detect(), GraphicsManager::detectGraphics(), GraphicsManager::detectPixelSize(), EAthena::Network::dispatchMessages(), TmwAthena::Network::dispatchMessages(), Font::doClean(), ServerDialog::downloadUpdate(), dumpLibs(), dumpLinkedSdlVersion(), dumpSettings(), dumpSizes(), Being::dumpSprites(), ImageHelper::dumpSurfaceFormat(), Dye::Dye(), DyePalette::DyePalette(), error(), SoundManager::fadeOutMusic(), Font::Font(), Net::MessageIn::fromServerDirection(), Game::Game(), Client::gameClear(), Client::gameExec(), Client::gameInit(), EAthena::GeneralHandler::GeneralHandler(), TmwAthena::GeneralHandler::GeneralHandler(), ImageSet::get(), ResourceManager::get(), SpriteDef::getAction(), SDL::getAllVideoModes(), Theme::getColor(), UserPalette::getColor(), ScrollArea::getImageByState(), Theme::getProgressColor(), SafeOpenGLImageHelper::glLoad(), PIS_dotdotdot::ignore(), PIS_blinkname::ignore(), Resource::incRef(), SoundManager::info(), Joystick::init(), IPC::init(), SoundManager::init(), Perf::init(), Configuration::init(), EggSelectionDialog::initButtons(), Dirs::initConfigDir(), ConfigManager::initConfiguration(), initDefaultThemePath(), GraphicsManager::initGraphics(), GettextHelper::initLang(), Dirs::initRootDir(), Dirs::initScreenshotDir(), ConfigManager::initServerConfig(), Client::initSoundManager(), Dirs::initUpdatesDir(), Dye::instantiate(), OpenGLImageHelper::invalidate(), SafeOpenGLImageHelper::invalidate(), TestMain::invokeModernOpenGLRenderTest(), TestMain::invokeNormalOpenGLRenderTest(), TestMain::invokeSafeOpenGLRenderTest(), TestMain::invokeSoftwareRenderTest(), TestMain::invokeTest4(), itemTypeFromString(), CharDB::load(), Theme::load(), PoParser::load(), anonymous_namespace{musicloader.cpp}::ResourceLoader::load(), ImageHelper::load(), SafeOpenGLImageHelper::load(), Theme::loadColors(), Client::loadData(), VirtFs::FsDir::loadFile(), VirtFs::FsZip::loadFile(), Font::loadFont(), ColorDB::loadHair(), AtlasManager::loadImages(), Theme::loadInfo(), TranslationManager::loadLang(), UpdaterWindow::loadLocalUpdates(), PaletteDB::loadPalette(), ImageHelper::loadPng(), loadQuest(), ServerDialog::loadServers(), VirtFs::loadTextFile(), VirtFs::loadTextFileString(), loadTxtFile(), loadUnit(), UpdaterWindow::loadUpdates(), loadXMLFile(), EffectManager::loadXmlFile(), SkillDialog::loadXmlFile(), AvatarDB::loadXmlFile(), ClanDb::loadXmlFile(), CommandsDB::loadXmlFile(), DeadDB::loadXmlFile(), ElementalDb::loadXmlFile(), EmoteDB::loadXmlFile(), GroupDb::loadXmlFile(), HomunculusDB::loadXmlFile(), HorseDB::loadXmlFile(), ItemFieldDb::loadXmlFile(), ItemOptionDb::loadXmlFile(), MercenaryDB::loadXmlFile(), ModDB::loadXmlFile(), MonsterDB::loadXmlFile(), NPCDB::loadXmlFile(), PETDB::loadXmlFile(), SkillUnitDb::loadXmlFile(), StatDb::loadXmlFile(), StatusEffectDB::loadXmlFile(), UnitsDb::loadXmlFile(), ItemDB::loadXmlFile(), Mutex::lock(), log(), GraphicsManager::logError(), EventsManager::logEvent(), ServerDialog::logic(), UpdaterWindow::logic(), Joystick::logic(), Ea::LoginHandler::loginOrRegister(), ResourceManager::logResource(), ResourceManager::logResources(), GraphicsManager::logString(), Client::logVars(), GraphicsManager::logVersion(), VirtFs::mountDirInternal(), VirtFs::mountDirSilent(), VirtFs::mountDirSilent2(), VirtFs::mountZip(), VirtFs::mountZip2(), Joystick::open(), Font::openFont(), ParticleEmitter::ParticleEmitter(), SoundManager::playGuiSfx(), SoundManager::playSfx(), Popup::Popup(), ServerDialog::postInit(), MobileOpenGL2Graphics::postInit(), ModernOpenGLGraphics::postInit(), Theme::prepareThemePath(), Cpu::printFlags(), MemoryManager::printMemory(), Ea::BeingRecv::processBeingMove3(), EAthena::CashShopRecv::processCashShopSchedule(), EAthena::CashShopRecv::processCashShopTabPriceList(), EAthena::CharServerRecv::processCharCharacters(), EAthena::CharServerRecv::processCharLogin(), TmwAthena::CharServerRecv::processCharLogin(), EAthena::GeneralRecv::processConnectionProblem(), TmwAthena::GeneralRecv::processConnectionProblem(), EAthena::LoginRecv::processLoginData(), TmwAthena::LoginRecv::processLoginData(), Ea::LoginRecv::processLoginError(), EAthena::LoginRecv::processLoginError2(), EAthena::MailRecv::processMailList(), EAthena::GameRecv::processMapLogin(), TmwAthena::GameRecv::processMapLogin(), TmwAthena::InventoryRecv::processPlayerEquipment(), TmwAthena::InventoryRecv::processPlayerInventory(), TmwAthena::InventoryRecv::processPlayerStorage(), TmwAthena::InventoryRecv::processPlayerStorageEquip(), Ea::PlayerRecv::processPlayerWarp(), EAthena::MailRecv::processReadMail(), EAthena::LoginRecv::processServerVersion(), TmwAthena::LoginRecv::processServerVersion(), EAthena::SkillRecv::processSkillFailed(), TmwAthena::SkillRecv::processSkillFailed(), TmwAthena::TradeRecv::processTradeItemAddResponse(), Ea::LoginRecv::processUpdateHost(), EAthena::LoginRecv::processUpdateHost2(), MStack< T >::push(), VirtFs::ZipReader::readArchiveInfo(), MapDB::readAtlas(), readColor(), Net::MessageIn::readCoordinatePair(), Net::MessageIn::readCoordinates(), MapReader::readLayer(), BeingCommon::readObjectNodes(), Theme::readSkin(), MapReader::readTileset(), TestMain::readValue2(), readXmlIntMap(), readXmlIntVector(), readXmlStringMap(), Map::reduce(), EAthena::Network::registerFakeHandlers(), Configuration::reInit(), Configuration::removeOldKeys(), safeError(), Map::saveExtraLayer(), Game::saveScreenshot(), Perf::selectWorstFrame(), Being::setAction(), Desktop::setBestFittingWallpaper(), setBrandingDefaults(), CharSelectDialog::setCharacter(), setConfigDefaults(), setConfigDefaults2(), setEnv(), setFeaturesDefaults(), GraphicsManager::setGLVersion(), WindowManager::setIcon(), ComplexInventory::setItem(), Graphics::setMainFlags(), Graphics::setOpenGLMode(), setPathsDefaults(), Graphics::setScale(), NpcDialog::setSkin(), BeingInfo::setTargetCursorSize(), Gui::setUseCustomCursor(), GraphicsManager::setVideoMode(), Net::Download::start(), IPC::start(), IPC::stop(), SubImage::SubImage(), SoundManager::testAudio(), TranslationManager::translateFile(), unimplemented(), Mutex::unlock(), VirtFs::unmountDirInternal(), VirtFs::unmountDirSilent(), VirtFs::unmountDirSilent2(), VirtFs::unmountZip(), VirtFs::unmountZip2(), GraphicsManager::updateLimits(), Graphics::updateMemoryInfo(), GraphicsManager::updatePlanformExtensions(), EAthena::updateProtocol(), GraphicsManager::updateTextureCompressionFormat(), useButton2FromItemType(), useButtonFromItemType(), Graphics::videoInfo(), Window::Window(), TestMain::writeConfig(), ConfigurationObject::writeToXML(), Net::MessageIn::~MessageIn(), Popup::~Popup(), SubImage::~SubImage(), and Window::~Window().
void Logger::log | ( | const std::string & | str | ) |
Enters a message in the log. The message will be timestamped.
Definition at line 142 of file logger.cpp.
References log().
void Logger::log1 | ( | const char *const | log_text | ) |
Enters a message in the log. The message will be timestamped.
Definition at line 238 of file logger.cpp.
References DATESTREAM, Settings::disableLoggingInGame, mLogFile, mLogToStandardOut, settings, and SPECIALLOG.
Referenced by ConnectionDialog::action(), Map::addExtraLayer(), LayoutArray::align(), ResourceManager::clearDeleted(), SoundManager::close(), Ea::Network::connect(), MapReader::createEmptyMap(), GraphicsManager::createTextureSampler(), ResourceManager::deleteInstance(), GraphicsManager::detectGraphics(), EffectManager::EffectManager(), Client::gameClear(), Client::gameExec(), Client::gameInit(), SDL::getAllVideoModes(), EventsManager::handleCommonEvents(), EventsManager::handleEvents(), SoundManager::info(), SoundManager::init(), Configuration::init(), ConfigManager::initConfiguration(), GraphicsManager::initOpenGLFunctions(), Dirs::initUpdatesDir(), AvatarDB::load(), BadgesDB::load(), CharDB::load(), ClanDb::load(), ColorDB::load(), CommandsDB::load(), DeadDB::load(), ElementalDb::load(), EmoteDB::load(), GroupDb::load(), HomunculusDB::load(), HorseDB::load(), ItemDB::load(), ItemFieldDb::load(), ItemOptionDb::load(), LanguageDb::load(), MapDB::load(), MercenaryDB::load(), ModDB::load(), MonsterDB::load(), NetworkDb::load(), NPCDB::load(), NpcDialogDB::load(), PaletteDB::load(), PETDB::load(), QuestDb::load(), SkillUnitDb::load(), SoundDB::load(), StatDb::load(), StatusEffectDB::load(), TextDb::load(), UnitsDb::load(), WeaponsDB::load(), loadHostsGroup(), UpdaterWindow::loadNews(), UpdaterWindow::loadPatch(), ServerDialog::loadServers(), EmoteDB::loadSpecialXmlFile(), LocalPlayer::LocalPlayer(), Joystick::open(), ParticleEmitter::ParticleEmitter(), Gui::postInit(), EAthena::GuildRecv::processGuildMemberList(), EAthena::GuildRecv::processGuildPosNameList(), EAthena::PartyRecv::processPartyInfo(), TmwAthena::PartyRecv::processPartyInfo(), Ea::PlayerRecv::processPlayerWarp(), Ea::LoginRecv::processUpdateHost(), EAthena::LoginRecv::processUpdateHost2(), Theme::readSkin(), Map::saveExtraLayer(), Game::saveScreenshot(), Graphics::setOpenGLMode(), ParticleEngine::setupEngine(), Net::Download::start(), ConfigManager::storeSafeParameters(), AvatarDB::unload(), BadgesDB::unload(), CharDB::unload(), ClanDb::unload(), ColorDB::unload(), CommandsDB::unload(), DeadDB::unload(), ElementalDb::unload(), EmoteDB::unload(), GroupDb::unload(), HomunculusDB::unload(), HorseDB::unload(), ItemDB::unload(), ItemFieldDb::unload(), ItemOptionDb::unload(), LanguageDb::unload(), MapDB::unload(), MercenaryDB::unload(), ModDB::unload(), MonsterDB::unload(), NetworkDb::unload(), NPCDB::unload(), NpcDialogDB::unload(), PaletteDB::unload(), PETDB::unload(), QuestDb::unload(), SkillUnitDb::unload(), SoundDB::unload(), StatDb::unload(), StatusEffectDB::unload(), TextDb::unload(), UnitsDb::unload(), WeaponsDB::unload(), GraphicsManager::updateDebugLog(), GraphicsManager::updateExtensions(), GraphicsManager::updatePlanformExtensions(), GraphicsManager::updateTextureCompressionFormat(), GraphicsManager::updateTextureFormat(), Graphics::videoInfo(), Configuration::write(), ItemShortcut::~ItemShortcut(), and LocalPlayer::~LocalPlayer().
void Logger::log_r | ( | const char *const | log_text, |
... | |||
) |
Enters a message in the log (thread safe).
Definition at line 365 of file logger.cpp.
References CAST_SIZE, CAST_U32, DATESTREAM, Settings::disableLoggingInGame, mDelayedLog, mLogFile, mLogToStandardOut, mMutex, mThreadLocked, settings, EmoteDB::size(), SPECIALLOG, and strprintf().
Referenced by IPC::acceptLoop(), Net::Download::downloadThread(), TcpNet::open(), Ea::Network::realConnect(), Ea::Network::receive(), Ea::Network::setError(), and xmlErrorLogger().
void Logger::safeError | ( | const std::string & | error_text | ) |
Log an error and quit. The error will pop-up on Windows and Mac, and will be printed to standard error everywhere else.
Definition at line 435 of file logger.cpp.
References log(), and Actions::msg().
Referenced by Setup_Video::apply(), ConfigManager::backupConfig(), EAthena::Network::dispatchMessages(), TmwAthena::Network::dispatchMessages(), Client::gameInit(), MobileOpenGL2Graphics::postInit(), ModernOpenGLGraphics::postInit(), and GraphicsManager::setVideoMode().
|
inline |
Definition at line 181 of file logger.h.
References mDebugLog.
Referenced by Setup_Misc::apply(), and Client::gameInit().
void Logger::setLogFile | ( | const std::string & | logFilename | ) |
Sets the file to log to and opens it
Definition at line 120 of file logger.cpp.
References closeFile(), mLogFile, and mLogToStandardOut.
Referenced by Client::gameInit(), and TestMain::TestMain().
|
inline |
Sets whether the log should be written to standard output.
Definition at line 91 of file logger.h.
References mLogToStandardOut.
|
inline |
Definition at line 184 of file logger.h.
References mReportUnimplemented.
Referenced by Setup_Misc::apply(), and Client::gameInit().
void Logger::unimplemented | ( | const int | id | ) |
Definition at line 508 of file logger.cpp.
References CAST_U32, DebugMessageListener::distributeEvent(), log(), mReportUnimplemented, and strprintf().
void Logger::unimplemented | ( | const int | id, |
const int | id2 | ||
) |
Definition at line 520 of file logger.cpp.
References CAST_U32, DebugMessageListener::distributeEvent(), log(), mReportUnimplemented, and strprintf().
void Logger::unimplemented | ( | const uint32_t | id, |
const uint32_t | id2, | ||
const uint32_t | id3 | ||
) | const |
Definition at line 535 of file logger.cpp.
References DebugMessageListener::distributeEvent(), mReportUnimplemented, and strprintf().
|
private |
Definition at line 224 of file logger.h.
Referenced by dlog(), dlog2(), and setDebugLog().
|
private |
|
private |
Definition at line 219 of file logger.h.
Referenced by assertLog(), closeFile(), dlog(), dlog2(), flush(), getFile(), log(), log1(), log_r(), and setLogFile().
|
private |
Definition at line 223 of file logger.h.
Referenced by assertLog(), dlog(), dlog2(), log(), log1(), log_r(), setLogFile(), and setLogToStandardOut().
|
private |
|
private |
Definition at line 225 of file logger.h.
Referenced by setReportUnimplemented(), and unimplemented().
|
private |