void unLogWindow::DoLog(wxLogLevel level, const wxChar *str, time_t t) { // first let the previous logger show it wxLogPassThrough::DoLog(level, str, t); if( LogFrame ) { switch( level ) { case wxLOG_Status: // by default, these messages are ignored by wxLog, so process // them ourselves if( !wxIsEmpty(str) ) { wxString str; str << _("Status: ") << str; DoLogString(str, t); } break; // don't put trace messages in the text window for 2 reasons: // 1) there are too many of them // 2) they may provoke other trace messages thus sending a program // into an infinite loop case wxLOG_Trace: break; default: // and this will format it nicely and call our DoLogString() wxLog::DoLog(level, str, t); } } }
void CLogger::DoLog(wxLogLevel level, const wxChar* msg, time_t timestamp) { wxASSERT(m_file != NULL); wxASSERT(m_file->IsOpened()); wxASSERT(msg != NULL); wxString letter; switch (level) { case wxLOG_FatalError: letter = wxT("F"); break; case wxLOG_Error: letter = wxT("E"); break; case wxLOG_Warning: letter = wxT("W"); break; case wxLOG_Info: letter = wxT("I"); break; case wxLOG_Message: letter = wxT("M"); break; case wxLOG_Status: letter = wxT("M"); break; case wxLOG_Trace: letter = wxT("T"); break; case wxLOG_Debug: letter = wxT("D"); break; default: letter = wxT("U"); break; } struct tm* tm = ::gmtime(×tamp); wxString message; message.Printf(wxT("%s: %04d-%02d-%02d %02d:%02d:%02d: %s\n"), letter.c_str(), tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, msg); DoLogString(message.c_str(), timestamp); if (level == wxLOG_FatalError) ::abort(); }
// Description: Writes one line to output logfile. // // Arguments: // level: Type of message. // szString: String to write. // t: Current time. void OutputLog::DoLog( wxLogLevel level, const char *szString, time_t t ) { switch (level) { case wxLOG_Message: default: DoLogString(szString, t); break; } }
void wxLog::DoLog(wxLogLevel level, const wxChar *szString, time_t t) { switch ( level ) { case wxLOG_FatalError: DoLogString(wxString(_("Fatal error: ")) + szString, t); DoLogString(_("Program aborted."), t); Flush(); #ifdef __WXWINCE__ ExitThread(3); #else abort(); #endif break; case wxLOG_Error: DoLogString(wxString(_("Error: ")) + szString, t); break; case wxLOG_Warning: DoLogString(wxString(_("Warning: ")) + szString, t); break; case wxLOG_Info: if ( GetVerbose() ) case wxLOG_Message: case wxLOG_Status: default: // log unknown log levels too DoLogString(szString, t); break; case wxLOG_Trace: case wxLOG_Debug: #ifdef __WXDEBUG__ { wxString msg = level == wxLOG_Trace ? wxT("Trace: ") : wxT("Debug: "); msg << szString; DoLogString(msg, t); } #endif // Debug break; } }
void wxLog::DoLog(wxLogLevel WXUNUSED(level), const wchar_t *wzString, time_t t) { DoLogString(wzString, t); }
void wxLog::DoLog(wxLogLevel WXUNUSED(level), const char *szString, time_t t) { DoLogString(szString, t); }
void AudacityLogger::OnClear(wxCommandEvent & WXUNUSED(e)) { mBuffer = wxEmptyString; DoLogString(wxT("Log Cleared."), 0); }