Пример #1
0
Log::Log() : worker(NULL)
{
    SetRealmID(0);
    m_logsTimestamp = "_" + GetTimestampStr();
    LoadFromConfig();
    pandashanLog = fopen(std::string(m_logsDir).append("pandashan.log").c_str(), "a");
}
Пример #2
0
Log::Log() : worker(NULL)
{
    SetRealmID(0);
    m_logsTimestamp = "_" + GetTimestampStr();
    LoadFromConfig();
    pandashanLog = fopen("pandashan.log", "a");
}
Пример #3
0
void Log::Initialize()
{
    /// Check whether we'll log GM commands/RA events/character outputs/chat stuffs
    m_dbChar = sConfig->GetBoolDefault("LogDB.Char", false);
    m_dbRA = sConfig->GetBoolDefault("LogDB.RA", false);
    m_dbGM = sConfig->GetBoolDefault("LogDB.GM", false);
    m_dbChat = sConfig->GetBoolDefault("LogDB.Chat", false);

    /// Realm must be 0 by default
    SetRealmID(0);

    /// Common log files data
    m_logsDir = sConfig->GetStringDefault("LogsDir", "");
    if(!m_logsDir.empty())
        if((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\'))
            m_logsDir.append("/");

    m_logsTimestamp = "_" + GetTimestampStr();

    /// Open specific log files
    logfile = openLogFile("LogFile", "LogTimestamp", "w");
    InitColors(sConfig->GetStringDefault("LogColors", ""));

    m_gmlog_per_account = sConfig->GetBoolDefault("GmLogPerAccount", false);
    if(!m_gmlog_per_account)
        gmLogfile = openLogFile("GMLogFile", "GmLogTimestamp", "a");
    else
    {
        // GM log settings for per account case
        m_gmlog_filename_format = sConfig->GetStringDefault("GMLogFile", "");
        if(!m_gmlog_filename_format.empty())
        {
            bool m_gmlog_timestamp = sConfig->GetBoolDefault("GmLogTimestamp", false);

            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);

                m_gmlog_filename_format.insert(dot_pos, "_#%u");
            }
            else
            {
                m_gmlog_filename_format += "_#%u";

                if(m_gmlog_timestamp)
                    m_gmlog_filename_format += m_logsTimestamp;
            }

            m_gmlog_filename_format = m_logsDir + m_gmlog_filename_format;
        }
    }

    charLogfile     = openLogFile("CharLogFile", "CharLogTimestamp", "a");
    dberLogfile     = openLogFile("DBErrorLogFile", NULL, "a");
    raLogfile       = openLogFile("RASOAP", NULL, "a");
    chatLogfile     = openLogFile("ChatLogFile", "ChatLogTimestamp", "a");
    arenaLogFile    = openLogFile("ArenaLogFile", NULL, "a");
    sqlLogFile      = openLogFile("SQLDriverLogFile", NULL, "a");
    sqlDevLogFile   = openLogFile("SQLDeveloperLogFile", NULL, "a");
    wardenLogFile   = openLogFile("WardenLogFile", NULL, "a");

    // Main log file settings
    m_logLevel     = sConfig->GetIntDefault("LogLevel", LOGL_NORMAL);
    m_logFileLevel = sConfig->GetIntDefault("LogFileLevel", LOGL_NORMAL);
    m_dbLogLevel   = sConfig->GetIntDefault("DBLogLevel", LOGL_NORMAL);
    m_sqlDriverQueryLogging  = sConfig->GetBoolDefault("SQLDriverQueryLogging", false);

    m_DebugLogMask = DebugLogFilters(sConfig->GetIntDefault("DebugLogMask", LOG_FILTER_NONE));

    // Char log settings
    m_charLog_Dump = sConfig->GetBoolDefault("CharLogDump", false);
    m_charLog_Dump_Separate = sConfig->GetBoolDefault("CharLogDump.Separate", false);
    if(m_charLog_Dump_Separate)
    {
        m_dumpsDir = sConfig->GetStringDefault("CharLogDump.SeparateDir", "");
        if(!m_dumpsDir.empty())
            if((m_dumpsDir.at(m_dumpsDir.length() - 1) != '/') && (m_dumpsDir.at(m_dumpsDir.length() - 1) != '\\'))
                m_dumpsDir.append("/");
    }
}
Пример #4
0
Log::Log() : worker(NULL)
{
    SetRealmID(0);
    m_logsTimestamp = "_" + GetTimestampStr();
    LoadFromConfig();
}
Пример #5
0
void Log::Initialize()
{
    /// Check whether we'll log GM commands/RA events/character outputs/chat stuffs
    m_dbChar = sConfig->GetBoolDefault("LogDB.Char", false);
    m_dbRA = sConfig->GetBoolDefault("LogDB.RA", false);
    m_dbGM = sConfig->GetBoolDefault("LogDB.GM", false);
    m_dbChat = sConfig->GetBoolDefault("LogDB.Chat", false);

    /// Realm must be 0 by default
    SetRealmID(0);

    /// Common log files data
    m_logsDir = sConfig->GetStringDefault("LogsDir","");
    if (!m_logsDir.empty())
        if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\'))
            m_logsDir.append("/");

    m_logsTimestamp = "_" + GetTimestampStr();

    /// Open specific log files
    logfile = openLogFile("LogFile","LogTimestamp","w");
    InitColors(sConfig->GetStringDefault("LogColors", ""));

    m_gmlog_per_account = sConfig->GetBoolDefault("GmLogPerAccount",false);
    if(!m_gmlog_per_account)
        gmLogfile = openLogFile("GMLogFile","GmLogTimestamp","a");
    else
    {
        // GM log settings for per account case
        m_gmlog_filename_format = sConfig->GetStringDefault("GMLogFile", "");
        if(!m_gmlog_filename_format.empty())
        {
            bool m_gmlog_timestamp = sConfig->GetBoolDefault("GmLogTimestamp",false);

            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);

                m_gmlog_filename_format.insert(dot_pos,"_#%u");
            }
            else
            {
                m_gmlog_filename_format += "_#%u";

                if(m_gmlog_timestamp)
                    m_gmlog_filename_format += m_logsTimestamp;
            }

            m_gmlog_filename_format = m_logsDir + m_gmlog_filename_format;
        }
    }

    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");

    // Main log file settings
    m_logLevel     = sConfig->GetIntDefault("LogLevel", LOGL_NORMAL);
    m_logFileLevel = sConfig->GetIntDefault("LogFileLevel", LOGL_NORMAL);
    m_dbLogLevel   = sConfig->GetIntDefault("DBLogLevel", LOGL_NORMAL);
    m_sqlDriverQueryLogging  = sConfig->GetBoolDefault("SQLDriverQueryLogging", false);

    m_logFilter = 0;

    if(sConfig->GetBoolDefault("LogFilter_TransportMoves", true))
        m_logFilter |= LOG_FILTER_TRANSPORT_MOVES;
    if(sConfig->GetBoolDefault("LogFilter_CreatureMoves", true))
        m_logFilter |= LOG_FILTER_CREATURE_MOVES;
    if(sConfig->GetBoolDefault("LogFilter_VisibilityChanges", true))
        m_logFilter |= LOG_FILTER_VISIBILITY_CHANGES;
    if(sConfig->GetBoolDefault("LogFilter_AchievementUpdates", true))
        m_logFilter |= LOG_FILTER_ACHIEVEMENT_UPDATES;

    // Char log settings
    m_charLog_Dump = sConfig->GetBoolDefault("CharLogDump", false);
    m_charLog_Dump_Separate = sConfig->GetBoolDefault("CharLogDump.Separate", false);
    if (m_charLog_Dump_Separate)
    {
        m_dumpsDir = sConfig->GetStringDefault("CharLogDump.SeparateDir", "");
        if (!m_dumpsDir.empty())
            if ((m_dumpsDir.at(m_dumpsDir.length() - 1) != '/') && (m_dumpsDir.at(m_dumpsDir.length() - 1) != '\\'))
                m_dumpsDir.append("/");
    }
}