fix harmless warnings about uninitialized (not really) variables in MSVC release...
[wxWidgets.git] / src / common / log.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/log.cpp
3 // Purpose: Assorted wxLogXXX functions, and wxLog (sink for logs)
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 29/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26
27 #if wxUSE_LOG
28
29 // wxWidgets
30 #ifndef WX_PRECOMP
31 #include "wx/log.h"
32 #include "wx/app.h"
33 #include "wx/arrstr.h"
34 #include "wx/intl.h"
35 #include "wx/string.h"
36 #include "wx/utils.h"
37 #endif //WX_PRECOMP
38
39 #include "wx/apptrait.h"
40 #include "wx/datetime.h"
41 #include "wx/file.h"
42 #include "wx/msgout.h"
43 #include "wx/textfile.h"
44 #include "wx/thread.h"
45 #include "wx/crt.h"
46
47 // other standard headers
48 #ifndef __WXWINCE__
49 #include <errno.h>
50 #endif
51
52 #include <stdlib.h>
53
54 #ifndef __WXPALMOS5__
55 #ifndef __WXWINCE__
56 #include <time.h>
57 #else
58 #include "wx/msw/wince/time.h"
59 #endif
60 #endif /* ! __WXPALMOS5__ */
61
62 #if defined(__WINDOWS__)
63 #include "wx/msw/private.h" // includes windows.h
64 #endif
65
66 #if wxUSE_THREADS
67
68 // define static functions providing access to the critical sections we use
69 // instead of just using static critical section variables as log functions may
70 // be used during static initialization and while this is certainly not
71 // advisable it's still better to not crash (as we'd do if we used a yet
72 // uninitialized critical section) if it happens
73
74 static inline wxCriticalSection& GetTraceMaskCS()
75 {
76 static wxCriticalSection s_csTrace;
77
78 return s_csTrace;
79 }
80
81 static inline wxCriticalSection& GetPreviousLogCS()
82 {
83 static wxCriticalSection s_csPrev;
84
85 return s_csPrev;
86 }
87
88 #endif // wxUSE_THREADS
89
90 // ----------------------------------------------------------------------------
91 // non member functions
92 // ----------------------------------------------------------------------------
93
94 // define this to enable wrapping of log messages
95 //#define LOG_PRETTY_WRAP
96
97 #ifdef LOG_PRETTY_WRAP
98 static void wxLogWrap(FILE *f, const char *pszPrefix, const char *psz);
99 #endif
100
101 // ----------------------------------------------------------------------------
102 // module globals
103 // ----------------------------------------------------------------------------
104
105 namespace
106 {
107
108 // this struct is used to store information about the previous log message used
109 // by OnLog() to (optionally) avoid logging multiple copies of the same message
110 struct PreviousLogInfo
111 {
112 PreviousLogInfo()
113 {
114 numRepeated = 0;
115 }
116
117
118 // previous message itself
119 wxString msg;
120
121 // its level
122 wxLogLevel level;
123
124 // other information about it
125 wxLogRecordInfo info;
126
127 // the number of times it was already repeated
128 unsigned numRepeated;
129 };
130
131 PreviousLogInfo gs_prevLog;
132
133 } // anonymous namespace
134
135 // ============================================================================
136 // implementation
137 // ============================================================================
138
139 // ----------------------------------------------------------------------------
140 // helper global functions
141 // ----------------------------------------------------------------------------
142
143 void wxSafeShowMessage(const wxString& title, const wxString& text)
144 {
145 #ifdef __WINDOWS__
146 ::MessageBox(NULL, text.t_str(), title.t_str(), MB_OK | MB_ICONSTOP);
147 #else
148 wxFprintf(stderr, wxS("%s: %s\n"), title.c_str(), text.c_str());
149 fflush(stderr);
150 #endif
151 }
152
153 // ----------------------------------------------------------------------------
154 // wxLog class implementation
155 // ----------------------------------------------------------------------------
156
157 unsigned wxLog::LogLastRepeatIfNeeded()
158 {
159 wxCRIT_SECT_LOCKER(lock, GetPreviousLogCS());
160
161 return LogLastRepeatIfNeededUnlocked();
162 }
163
164 unsigned wxLog::LogLastRepeatIfNeededUnlocked()
165 {
166 const unsigned count = gs_prevLog.numRepeated;
167
168 if ( gs_prevLog.numRepeated )
169 {
170 wxString msg;
171 #if wxUSE_INTL
172 msg.Printf(wxPLURAL("The previous message repeated once.",
173 "The previous message repeated %lu times.",
174 gs_prevLog.numRepeated),
175 gs_prevLog.numRepeated);
176 #else
177 msg.Printf(wxS("The previous message was repeated %lu times."),
178 gs_prevLog.numRepeated);
179 #endif
180 gs_prevLog.numRepeated = 0;
181 gs_prevLog.msg.clear();
182 DoLogRecord(gs_prevLog.level, msg, gs_prevLog.info);
183 }
184
185 return count;
186 }
187
188 wxLog::~wxLog()
189 {
190 // Flush() must be called before destroying the object as otherwise some
191 // messages could be lost
192 if ( gs_prevLog.numRepeated )
193 {
194 wxMessageOutputDebug().Printf
195 (
196 wxS("Last repeated message (\"%s\", %lu times) wasn't output"),
197 gs_prevLog.msg,
198 gs_prevLog.numRepeated
199 );
200 }
201 }
202
203 // ----------------------------------------------------------------------------
204 // wxLog logging functions
205 // ----------------------------------------------------------------------------
206
207 /* static */
208 void
209 wxLog::OnLog(wxLogLevel level, const wxString& msg, time_t t)
210 {
211 wxLogRecordInfo info;
212 info.timestamp = t;
213 #if wxUSE_THREADS
214 info.threadId = wxThread::GetCurrentId();
215 #endif // wxUSE_THREADS
216
217 OnLog(level, msg, info);
218 }
219
220 /* static */
221 void
222 wxLog::OnLog(wxLogLevel level,
223 const wxString& msg,
224 const wxLogRecordInfo& info)
225 {
226 // fatal errors can't be suppressed nor handled by the custom log target
227 // and always terminate the program
228 if ( level == wxLOG_FatalError )
229 {
230 wxSafeShowMessage(wxS("Fatal Error"), msg);
231
232 #ifdef __WXWINCE__
233 ExitThread(3);
234 #else
235 abort();
236 #endif
237 }
238
239 wxLog *pLogger = GetActiveTarget();
240 if ( !pLogger )
241 return;
242
243 if ( GetRepetitionCounting() )
244 {
245 wxCRIT_SECT_LOCKER(lock, GetPreviousLogCS());
246
247 if ( msg == gs_prevLog.msg )
248 {
249 gs_prevLog.numRepeated++;
250
251 // nothing else to do, in particular, don't log the
252 // repeated message
253 return;
254 }
255
256 pLogger->LogLastRepeatIfNeededUnlocked();
257
258 // reset repetition counter for a new message
259 gs_prevLog.msg = msg;
260 gs_prevLog.level = level;
261 gs_prevLog.info = info;
262 }
263
264 // handle extra data which may be passed to us by wxLogXXX()
265 wxString prefix, suffix;
266 wxUIntPtr num = 0;
267 if ( info.GetNumValue(wxLOG_KEY_SYS_ERROR_CODE, &num) )
268 {
269 long err = static_cast<long>(num);
270 if ( !err )
271 err = wxSysErrorCode();
272
273 suffix.Printf(_(" (error %ld: %s)"), err, wxSysErrorMsg(err));
274 }
275
276 #if wxUSE_LOG_TRACE
277 wxString str;
278 if ( level == wxLOG_Trace && info.GetStrValue(wxLOG_KEY_TRACE_MASK, &str) )
279 {
280 prefix = "(" + str + ") ";
281 }
282 #endif // wxUSE_LOG_TRACE
283
284 pLogger->DoLogRecord(level, prefix + msg + suffix, info);
285 }
286
287 void wxLog::DoLogRecord(wxLogLevel level,
288 const wxString& msg,
289 const wxLogRecordInfo& info)
290 {
291 #if WXWIN_COMPATIBILITY_2_8
292 // call the old DoLog() to ensure that existing custom log classes still
293 // work
294 //
295 // as the user code could have defined it as either taking "const char *"
296 // (in ANSI build) or "const wxChar *" (in ANSI/Unicode), we have no choice
297 // but to call both of them
298 DoLog(level, (const char*)msg.mb_str(), info.timestamp);
299 DoLog(level, (const wchar_t*)msg.wc_str(), info.timestamp);
300 #endif // WXWIN_COMPATIBILITY_2_8
301
302
303 // TODO: it would be better to extract message formatting in a separate
304 // wxLogFormatter class but for now we hard code formatting here
305
306 wxString prefix;
307
308 // don't time stamp debug messages under MSW as debug viewers usually
309 // already have an option to do it
310 #ifdef __WXMSW__
311 if ( level != wxLOG_Debug && level != wxLOG_Trace )
312 #endif // __WXMSW__
313 TimeStamp(&prefix);
314
315 // TODO: use the other wxLogRecordInfo fields
316
317 switch ( level )
318 {
319 case wxLOG_Error:
320 prefix += _("Error: ");
321 break;
322
323 case wxLOG_Warning:
324 prefix += _("Warning: ");
325 break;
326
327 // don't prepend "debug/trace" prefix under MSW as it goes to the debug
328 // window anyhow and so can't be confused with something else
329 #ifndef __WXMSW__
330 case wxLOG_Debug:
331 // this prefix (as well as the one below) is intentionally not
332 // translated as nobody translates debug messages anyhow
333 prefix += "Debug: ";
334 break;
335
336 case wxLOG_Trace:
337 prefix += "Trace: ";
338 break;
339 #endif // !__WXMSW__
340 }
341
342 DoLogTextAtLevel(level, prefix + msg);
343 }
344
345 void wxLog::DoLogTextAtLevel(wxLogLevel level, const wxString& msg)
346 {
347 // we know about debug messages (because using wxMessageOutputDebug is the
348 // right thing to do in 99% of all cases and also for compatibility) but
349 // anything else needs to be handled in the derived class
350 if ( level == wxLOG_Debug || level == wxLOG_Trace )
351 {
352 wxMessageOutputDebug().Output(msg + wxS('\n'));
353 }
354 else
355 {
356 DoLogText(msg);
357 }
358 }
359
360 void wxLog::DoLogText(const wxString& WXUNUSED(msg))
361 {
362 // in 2.8-compatible build the derived class might override DoLog() or
363 // DoLogString() instead so we can't have this assert there
364 #if !WXWIN_COMPATIBILITY_2_8
365 wxFAIL_MSG( "must be overridden if it is called" );
366 #endif // WXWIN_COMPATIBILITY_2_8
367 }
368
369 #if WXWIN_COMPATIBILITY_2_8
370
371 void wxLog::DoLog(wxLogLevel WXUNUSED(level), const char *szString, time_t t)
372 {
373 DoLogString(szString, t);
374 }
375
376 void wxLog::DoLog(wxLogLevel WXUNUSED(level), const wchar_t *wzString, time_t t)
377 {
378 DoLogString(wzString, t);
379 }
380
381 #endif // WXWIN_COMPATIBILITY_2_8
382
383 // ----------------------------------------------------------------------------
384 // wxLog active target management
385 // ----------------------------------------------------------------------------
386
387 wxLog *wxLog::GetActiveTarget()
388 {
389 if ( ms_bAutoCreate && ms_pLogger == NULL ) {
390 // prevent infinite recursion if someone calls wxLogXXX() from
391 // wxApp::CreateLogTarget()
392 static bool s_bInGetActiveTarget = false;
393 if ( !s_bInGetActiveTarget ) {
394 s_bInGetActiveTarget = true;
395
396 // ask the application to create a log target for us
397 if ( wxTheApp != NULL )
398 ms_pLogger = wxTheApp->GetTraits()->CreateLogTarget();
399 else
400 ms_pLogger = new wxLogStderr;
401
402 s_bInGetActiveTarget = false;
403
404 // do nothing if it fails - what can we do?
405 }
406 }
407
408 return ms_pLogger;
409 }
410
411 wxLog *wxLog::SetActiveTarget(wxLog *pLogger)
412 {
413 if ( ms_pLogger != NULL ) {
414 // flush the old messages before changing because otherwise they might
415 // get lost later if this target is not restored
416 ms_pLogger->Flush();
417 }
418
419 wxLog *pOldLogger = ms_pLogger;
420 ms_pLogger = pLogger;
421
422 return pOldLogger;
423 }
424
425 void wxLog::DontCreateOnDemand()
426 {
427 ms_bAutoCreate = false;
428
429 // this is usually called at the end of the program and we assume that it
430 // is *always* called at the end - so we free memory here to avoid false
431 // memory leak reports from wxWin memory tracking code
432 ClearTraceMasks();
433 }
434
435 void wxLog::DoCreateOnDemand()
436 {
437 ms_bAutoCreate = true;
438 }
439
440 void wxLog::AddTraceMask(const wxString& str)
441 {
442 wxCRIT_SECT_LOCKER(lock, GetTraceMaskCS());
443
444 ms_aTraceMasks.push_back(str);
445 }
446
447 void wxLog::RemoveTraceMask(const wxString& str)
448 {
449 wxCRIT_SECT_LOCKER(lock, GetTraceMaskCS());
450
451 int index = ms_aTraceMasks.Index(str);
452 if ( index != wxNOT_FOUND )
453 ms_aTraceMasks.RemoveAt((size_t)index);
454 }
455
456 void wxLog::ClearTraceMasks()
457 {
458 wxCRIT_SECT_LOCKER(lock, GetTraceMaskCS());
459
460 ms_aTraceMasks.Clear();
461 }
462
463 void wxLog::TimeStamp(wxString *str)
464 {
465 #if wxUSE_DATETIME
466 if ( !ms_timestamp.empty() )
467 {
468 wxChar buf[256];
469 time_t timeNow;
470 (void)time(&timeNow);
471
472 struct tm tm;
473 wxStrftime(buf, WXSIZEOF(buf),
474 ms_timestamp, wxLocaltime_r(&timeNow, &tm));
475
476 str->Empty();
477 *str << buf << wxS(": ");
478 }
479 #endif // wxUSE_DATETIME
480 }
481
482 void wxLog::Flush()
483 {
484 LogLastRepeatIfNeeded();
485 }
486
487 /*static*/ bool wxLog::IsAllowedTraceMask(const wxString& mask)
488 {
489 wxCRIT_SECT_LOCKER(lock, GetTraceMaskCS());
490
491 for ( wxArrayString::iterator it = ms_aTraceMasks.begin(),
492 en = ms_aTraceMasks.end();
493 it != en; ++it )
494 {
495 if ( *it == mask)
496 return true;
497 }
498
499 return false;
500 }
501
502 // ----------------------------------------------------------------------------
503 // wxLogBuffer implementation
504 // ----------------------------------------------------------------------------
505
506 void wxLogBuffer::Flush()
507 {
508 if ( !m_str.empty() )
509 {
510 wxMessageOutputBest out;
511 out.Printf(wxS("%s"), m_str.c_str());
512 m_str.clear();
513 }
514 }
515
516 void wxLogBuffer::DoLogTextAtLevel(wxLogLevel level, const wxString& msg)
517 {
518 // don't put debug messages in the buffer, we don't want to show
519 // them to the user in a msg box, log them immediately
520 switch ( level )
521 {
522 case wxLOG_Debug:
523 case wxLOG_Trace:
524 wxLog::DoLogTextAtLevel(level, msg);
525 break;
526
527 default:
528 m_str << msg << wxS("\n");
529 }
530 }
531
532 // ----------------------------------------------------------------------------
533 // wxLogStderr class implementation
534 // ----------------------------------------------------------------------------
535
536 wxLogStderr::wxLogStderr(FILE *fp)
537 {
538 if ( fp == NULL )
539 m_fp = stderr;
540 else
541 m_fp = fp;
542 }
543
544 void wxLogStderr::DoLogText(const wxString& msg)
545 {
546 wxFputs(msg + '\n', m_fp);
547 fflush(m_fp);
548
549 // under GUI systems such as Windows or Mac, programs usually don't have
550 // stderr at all, so show the messages also somewhere else, typically in
551 // the debugger window so that they go at least somewhere instead of being
552 // simply lost
553 if ( m_fp == stderr )
554 {
555 wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL;
556 if ( traits && !traits->HasStderr() )
557 {
558 wxMessageOutputDebug().Output(msg + wxS('\n'));
559 }
560 }
561 }
562
563 // ----------------------------------------------------------------------------
564 // wxLogStream implementation
565 // ----------------------------------------------------------------------------
566
567 #if wxUSE_STD_IOSTREAM
568 #include "wx/ioswrap.h"
569 wxLogStream::wxLogStream(wxSTD ostream *ostr)
570 {
571 if ( ostr == NULL )
572 m_ostr = &wxSTD cerr;
573 else
574 m_ostr = ostr;
575 }
576
577 void wxLogStream::DoLogText(const wxString& msg)
578 {
579 (*m_ostr) << msg << wxSTD endl;
580 }
581 #endif // wxUSE_STD_IOSTREAM
582
583 // ----------------------------------------------------------------------------
584 // wxLogChain
585 // ----------------------------------------------------------------------------
586
587 wxLogChain::wxLogChain(wxLog *logger)
588 {
589 m_bPassMessages = true;
590
591 m_logNew = logger;
592 m_logOld = wxLog::SetActiveTarget(this);
593 }
594
595 wxLogChain::~wxLogChain()
596 {
597 delete m_logOld;
598
599 if ( m_logNew != this )
600 delete m_logNew;
601 }
602
603 void wxLogChain::SetLog(wxLog *logger)
604 {
605 if ( m_logNew != this )
606 delete m_logNew;
607
608 m_logNew = logger;
609 }
610
611 void wxLogChain::Flush()
612 {
613 if ( m_logOld )
614 m_logOld->Flush();
615
616 // be careful to avoid infinite recursion
617 if ( m_logNew && m_logNew != this )
618 m_logNew->Flush();
619 }
620
621 void wxLogChain::DoLogRecord(wxLogLevel level,
622 const wxString& msg,
623 const wxLogRecordInfo& info)
624 {
625 // let the previous logger show it
626 if ( m_logOld && IsPassingMessages() )
627 m_logOld->LogRecord(level, msg, info);
628
629 // and also send it to the new one
630 if ( m_logNew && m_logNew != this )
631 m_logNew->LogRecord(level, msg, info);
632 }
633
634 #ifdef __VISUALC__
635 // "'this' : used in base member initializer list" - so what?
636 #pragma warning(disable:4355)
637 #endif // VC++
638
639 // ----------------------------------------------------------------------------
640 // wxLogInterposer
641 // ----------------------------------------------------------------------------
642
643 wxLogInterposer::wxLogInterposer()
644 : wxLogChain(this)
645 {
646 }
647
648 // ----------------------------------------------------------------------------
649 // wxLogInterposerTemp
650 // ----------------------------------------------------------------------------
651
652 wxLogInterposerTemp::wxLogInterposerTemp()
653 : wxLogChain(this)
654 {
655 DetachOldLog();
656 }
657
658 #ifdef __VISUALC__
659 #pragma warning(default:4355)
660 #endif // VC++
661
662 // ============================================================================
663 // Global functions/variables
664 // ============================================================================
665
666 // ----------------------------------------------------------------------------
667 // static variables
668 // ----------------------------------------------------------------------------
669
670 bool wxLog::ms_bRepetCounting = false;
671
672 wxLog *wxLog::ms_pLogger = NULL;
673 bool wxLog::ms_doLog = true;
674 bool wxLog::ms_bAutoCreate = true;
675 bool wxLog::ms_bVerbose = false;
676
677 wxLogLevel wxLog::ms_logLevel = wxLOG_Max; // log everything by default
678
679 size_t wxLog::ms_suspendCount = 0;
680
681 wxString wxLog::ms_timestamp(wxS("%X")); // time only, no date
682
683 #if WXWIN_COMPATIBILITY_2_8
684 wxTraceMask wxLog::ms_ulTraceMask = (wxTraceMask)0;
685 #endif // wxDEBUG_LEVEL
686
687 wxArrayString wxLog::ms_aTraceMasks;
688
689 // ----------------------------------------------------------------------------
690 // stdout error logging helper
691 // ----------------------------------------------------------------------------
692
693 // helper function: wraps the message and justifies it under given position
694 // (looks more pretty on the terminal). Also adds newline at the end.
695 //
696 // TODO this is now disabled until I find a portable way of determining the
697 // terminal window size (ok, I found it but does anybody really cares?)
698 #ifdef LOG_PRETTY_WRAP
699 static void wxLogWrap(FILE *f, const char *pszPrefix, const char *psz)
700 {
701 size_t nMax = 80; // FIXME
702 size_t nStart = strlen(pszPrefix);
703 fputs(pszPrefix, f);
704
705 size_t n;
706 while ( *psz != '\0' ) {
707 for ( n = nStart; (n < nMax) && (*psz != '\0'); n++ )
708 putc(*psz++, f);
709
710 // wrapped?
711 if ( *psz != '\0' ) {
712 /*putc('\n', f);*/
713 for ( n = 0; n < nStart; n++ )
714 putc(' ', f);
715
716 // as we wrapped, squeeze all white space
717 while ( isspace(*psz) )
718 psz++;
719 }
720 }
721
722 putc('\n', f);
723 }
724 #endif //LOG_PRETTY_WRAP
725
726 // ----------------------------------------------------------------------------
727 // error code/error message retrieval functions
728 // ----------------------------------------------------------------------------
729
730 // get error code from syste
731 unsigned long wxSysErrorCode()
732 {
733 #if defined(__WXMSW__) && !defined(__WXMICROWIN__)
734 return ::GetLastError();
735 #else //Unix
736 return errno;
737 #endif //Win/Unix
738 }
739
740 // get error message from system
741 const wxChar *wxSysErrorMsg(unsigned long nErrCode)
742 {
743 if ( nErrCode == 0 )
744 nErrCode = wxSysErrorCode();
745
746 #if defined(__WXMSW__) && !defined(__WXMICROWIN__)
747 static wxChar s_szBuf[1024];
748
749 // get error message from system
750 LPVOID lpMsgBuf;
751 if ( ::FormatMessage
752 (
753 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
754 NULL,
755 nErrCode,
756 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
757 (LPTSTR)&lpMsgBuf,
758 0,
759 NULL
760 ) == 0 )
761 {
762 // if this happens, something is seriously wrong, so don't use _() here
763 // for safety
764 wxSprintf(s_szBuf, wxS("unknown error %lx"), nErrCode);
765 return s_szBuf;
766 }
767
768
769 // copy it to our buffer and free memory
770 // Crashes on SmartPhone (FIXME)
771 #if !defined(__SMARTPHONE__) /* of WinCE */
772 if( lpMsgBuf != 0 )
773 {
774 wxStrlcpy(s_szBuf, (const wxChar *)lpMsgBuf, WXSIZEOF(s_szBuf));
775
776 LocalFree(lpMsgBuf);
777
778 // returned string is capitalized and ended with '\r\n' - bad
779 s_szBuf[0] = (wxChar)wxTolower(s_szBuf[0]);
780 size_t len = wxStrlen(s_szBuf);
781 if ( len > 0 ) {
782 // truncate string
783 if ( s_szBuf[len - 2] == wxS('\r') )
784 s_szBuf[len - 2] = wxS('\0');
785 }
786 }
787 else
788 #endif // !__SMARTPHONE__
789 {
790 s_szBuf[0] = wxS('\0');
791 }
792
793 return s_szBuf;
794 #else // !__WXMSW__
795 #if wxUSE_UNICODE
796 static wchar_t s_wzBuf[1024];
797 wxConvCurrent->MB2WC(s_wzBuf, strerror((int)nErrCode),
798 WXSIZEOF(s_wzBuf) - 1);
799 return s_wzBuf;
800 #else
801 return strerror((int)nErrCode);
802 #endif
803 #endif // __WXMSW__/!__WXMSW__
804 }
805
806 #endif // wxUSE_LOG