コード例 #1
0
ファイル: log.cpp プロジェクト: madnessw/thesnow
void wxLog::DoLogRecord(wxLogLevel level,
                             const wxString& msg,
                             const wxLogRecordInfo& info)
{
#if WXWIN_COMPATIBILITY_2_8
    // call the old DoLog() to ensure that existing custom log classes still
    // work
    //
    // as the user code could have defined it as either taking "const char *"
    // (in ANSI build) or "const wxChar *" (in ANSI/Unicode), we have no choice
    // but to call both of them
    DoLog(level, (const char*)msg.mb_str(), info.timestamp);
    DoLog(level, (const wchar_t*)msg.wc_str(), info.timestamp);
#else // !WXWIN_COMPATIBILITY_2_8
    wxUnusedVar(info);
#endif // WXWIN_COMPATIBILITY_2_8/!WXWIN_COMPATIBILITY_2_8


    // TODO: it would be better to extract message formatting in a separate
    //       wxLogFormatter class but for now we hard code formatting here

    wxString prefix;

    // don't time stamp debug messages under MSW as debug viewers usually
    // already have an option to do it
#ifdef __WXMSW__
    if ( level != wxLOG_Debug && level != wxLOG_Trace )
#endif // __WXMSW__
        TimeStamp(&prefix);

    // TODO: use the other wxLogRecordInfo fields

    switch ( level )
    {
        case wxLOG_Error:
            prefix += _("Error: ");
            break;

        case wxLOG_Warning:
            prefix += _("Warning: ");
            break;

        // don't prepend "debug/trace" prefix under MSW as it goes to the debug
        // window anyhow and so can't be confused with something else
#ifndef __WXMSW__
        case wxLOG_Debug:
            // this prefix (as well as the one below) is intentionally not
            // translated as nobody translates debug messages anyhow
            prefix += "Debug: ";
            break;

        case wxLOG_Trace:
            prefix += "Trace: ";
            break;
#endif // !__WXMSW__
    }

    DoLogTextAtLevel(level, prefix + msg);
}
コード例 #2
0
ファイル: log.cpp プロジェクト: madhugowda24/wxWidgets
void wxLog::DoLogRecord(wxLogLevel level,
                             const wxString& msg,
                             const wxLogRecordInfo& info)
{
#if WXWIN_COMPATIBILITY_2_8
    // call the old DoLog() to ensure that existing custom log classes still
    // work
    //
    // as the user code could have defined it as either taking "const char *"
    // (in ANSI build) or "const wxChar *" (in ANSI/Unicode), we have no choice
    // but to call both of them
    DoLog(level, (const char*)msg.mb_str(), info.timestamp);
    DoLog(level, (const wchar_t*)msg.wc_str(), info.timestamp);
#else // !WXWIN_COMPATIBILITY_2_8
    wxUnusedVar(info);
#endif // WXWIN_COMPATIBILITY_2_8/!WXWIN_COMPATIBILITY_2_8

    // Use wxLogFormatter to format the message
    DoLogTextAtLevel(level, m_formatter->Format (level, msg, info));
}
コード例 #3
0
ファイル: wxLogBalloon.cpp プロジェクト: jonny64/flybot
void wxLogBalloon::DoLogRecord(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& WXUNUSED(info))
{
    DoLogTextAtLevel(level, msg);
}