Commit Graph

166 Commits

Author SHA1 Message Date
Vadim Zeitlin
232addd1cd Made wxLogXXX() functions thread-safe.
They can now be called from any thread and will buffer the messages until the
current log target is flushed from the main thread. This makes earlier code to
do the same thing specifically for wxLogWindow unnecessary and also allows to
use wxLogMessage() in the thread sample instead of using manual logging there.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61416 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-12 17:02:30 +00:00
Vadim Zeitlin
c602c59b6e Add component-level filtering to wxLog.
Each log message is now associated with its component, "wx" by default for
messages generated by wxWidgets and wxLOG_COMPONENT in general (which is empty
by default). Each component may have its own log level and they are
hierarchical allowing fine configuration of what exactly is logged.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61414 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-12 14:56:23 +00:00
Vadim Zeitlin
b356aa554a don't mark GetTraceMask() deprecated as we use it in the same header which provokes warnings when including it from outside wx
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61367 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-09 22:00:30 +00:00
Vadim Zeitlin
c279530ba9 fix MSVC compilation: as string literals are of non-const char* type with this compiler, they are implicitly convertible to void* resulting in overloading ambiguities with wxLogger::Log()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61365 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-09 21:39:29 +00:00
Vadim Zeitlin
ff2e9e2cc4 implement wxLogTrace(wxTraceMask, format, ...) overload too
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61364 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-09 20:30:27 +00:00
Vadim Zeitlin
af58844636 Add information about the log message generation location to wxLog.
This means that wxLog::DoLogRecord() can now retrieve the file name, line
number and the function where the message was logged.

An unfortunate consequence of this change is that now

	if ( condition )
		wxLogError("Whatever");

results in a warning from g++ 4.x with -Wparentehses, so extra parentheses had
to be added in many places.

Finally, also allow storing arbitrary attributes in wxLogRecordInfo. This had
to be added to implement our own overloaded wxLogStatus() and wxLogSysError()
and will probably be useful for the others as well.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61363 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-09 20:26:34 +00:00
Vadim Zeitlin
ae2070fb77 fix VC6 warnings about not enough parameters for wxDEPRECATED_BUT_USED_INTERNALLY_INLINE
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61357 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-09 15:13:52 +00:00
Vadim Zeitlin
ba3af1010d added wxLog::IsLevelEnabled() helper; document it and a few related functions which were not, or poorly, documented
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61348 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-08 14:16:55 +00:00
Vadim Zeitlin
bc73d5aec8 Changed wxLog DoLogXXX() callbacks and introduced wxLogRecordInfo.
The main logging callback is now DoLogRecord() with DoLogTextAtLevel() and
DoLogText() provided for convenience. The old DoLog() and DoLogString() are
still called but deprecated and their overloads taking wxString which were
only added in 2.9.0 are removed.

wxLogRecordInfo allows associating more information than just the time stamp
with the log record; for now only the logging thread id was added but more
fields will make their appearance soon.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61346 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-08 13:47:33 +00:00
Vadim Zeitlin
5dd0965333 remove more occurrences of MSVC #pragma warning(default) (closes #10885)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61082 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-06-16 21:50:23 +00:00
Francesco Montorsi
d1279c9a3d no change: fix a couple typos
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60866 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-06-01 23:05:37 +00:00
Vadim Zeitlin
9d2214dd07 don't disable wxLogTrace() at debug levels < 2
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59759 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-23 10:42:17 +00:00
Vadim Zeitlin
69e3710eb7 add WXWIN_COMPATIBILITY_2_8 test around another wxLogTrace(wxTraceMask) occurrence
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59738 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-22 20:51:21 +00:00
Vadim Zeitlin
711f12ef2e made definition of wxUSE_LOG_DEBUG dependent on wxDEBUG_LEVEL and added wxUSE_LOG_TRACE (currently never enabled by default); fix warnings about unused variables after these changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59736 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-22 17:18:07 +00:00
Vadim Zeitlin
34085a0d4f deprecate integer trace masks and don't define the methods related to them if WXWIN_COMPATIBILITY_2_8==0
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59732 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-22 16:00:37 +00:00
Vadim Zeitlin
b895ab50e2 move forward declarations unneeded in wx/log.h to wx/generic/logg.h
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59731 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-22 15:40:53 +00:00
Vadim Zeitlin
23fb9bf573 define wxUSE_LOG_DEBUG as wxDEBUG_LEVEL and not as defined(__WXDEBUG__)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59730 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-22 15:40:08 +00:00
Vadim Zeitlin
efce878a2a add public wxLog::Log() to avoid ugly casts needed in order to call DoLog() from derived classes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59080 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-22 00:46:25 +00:00
Vadim Zeitlin
c0c133e13b add wx-prefixed and semicolon-requiring versions of DECLARE_NO_{COPY,ASSIGN}_CLASS macros
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58757 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-08 11:45:59 +00:00
Vadim Zeitlin
d3b9f782ef don't use annoying and unneeded in C++ casts of NULL to "T *" in all other files neither
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58227 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-19 13:55:27 +00:00
Vadim Zeitlin
dd639a4f27 a couple of more left over Borland unused variable/code warnings fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56466 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-10-20 10:52:17 +00:00
Vadim Zeitlin
766aecab3a use static functions instead of static variables for critical sections to avoid crashing if a log function using a CS is called during static objects initialization
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52594 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-03-17 21:09:02 +00:00
Vadim Zeitlin
f96233d53e protect access to ms_aTraceMasks with a critical section (replaces patch 1911172)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52541 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-03-15 03:42:48 +00:00
Vadim Zeitlin
9b4da62701 PalmOS compilation fixes (wx-trunk-out.diff part of patch 1894861)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52226 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-03-02 00:43:06 +00:00
Vadim Zeitlin
dbaa16de07 don't lock the gs_prevCS critical section recursively (replaces patch 1857581)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50993 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-02 21:18:15 +00:00
Paul Cornett
204abcd474 remove unneccessary header dependencies on wx/thread.h
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50443 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-12-03 02:55:14 +00:00
Vadim Zeitlin
c1f80bc0a6 made LogLastRepetitionCountIfNeeded() non static to avoid recreating the log target from ~wxLog
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49587 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-11-01 20:22:06 +00:00
Vadim Zeitlin
0250efd6f4 use LogLastRepetitionCountIfNeeded() instead of DoLogNumberOfRepeats() in logg.cpp too
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49410 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-10-24 22:19:28 +00:00
Vadim Zeitlin
a2d3826500 add a critical section protecting ms_prev variables (replaces patch 1819224)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49404 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-10-24 17:59:53 +00:00
Vadim Zeitlin
2064113c9d slightly simplified wxLog repetition counting code
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49403 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-10-24 17:55:29 +00:00
Václav Slavík
99fda03aa3 Mingw compilation fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48048 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-08-13 14:43:44 +00:00
Václav Slavík
b5dbe15d0b added WXDLLIMPEXP_FWD_FOO macros in addition to WXDLLIMPEXP_FOO for use with forward declarations (in preparation for GCC visibility support)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47254 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-07-09 10:09:52 +00:00
Vadim Zeitlin
7b1bf3ad2d added wxLog::DisableTimestamp() to be used as a synonym for SetTimestamp(wxEmptyString)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46976 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-27 12:09:55 +00:00
Vadim Zeitlin
b99891b0c8 suppress virtual function hiding warnings due to the existence of several DoLog() and DoLogString() overloads of which only one is overridden
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46646 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-22 18:09:03 +00:00
Julian Smart
47fe7ff382 Added DetachOldLog to avoid destruction of old log target
Renamed wxLogPassThrough to wxLogInterposer
Added wxLogInterposerTemp


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46580 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-21 12:44:38 +00:00
Václav Slavík
d993e05b2d wxLog::Get/Settimestamp() now use wxString
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46539 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-19 14:51:10 +00:00
Vadim Zeitlin
5d88a6b579 added wxDEPRECATED_BUT_USED_INTERNALLY macro and use it for the old wxLog::DoLog() overloads
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46479 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-15 15:08:51 +00:00
Václav Slavík
5a20d2ced0 changed wxLog::OnLog(String) to take wxString instead of wxChar* to avoid unnecessary conversions; added compatibility code so that user code overriding these with char* or wchar_t* argument continues to work
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46318 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-04 10:04:05 +00:00
Václav Slavík
0accd1cfe8 1. make debugging macros compatible with ANSI build even in Unicode build (i.e., no need to use _T() in message strings)
2. save space in binary by using ANSI literals for filenames and expression strings in debug macros


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46145 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-21 18:02:57 +00:00
David Elliott
e94cd97dd7 Add a wxLog::DoCreateOnDemand and call it from DoCommonPreInit so that
logging will work even if wxWidgets is reentered after being cleaned up.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46117 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-18 21:17:06 +00:00
Václav Slavík
59a14f6984 fix compation with Watcom after latest vararg templates changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45862 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-06 14:11:14 +00:00
Václav Slavík
1528e0b85f use wxFormatString helper class for 'vararg' functions' format argument; this prepares the code for removal of implicit wxString conversion to char* in STL build and also fixes VC6 compilation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45803 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-04 10:41:08 +00:00
Václav Slavík
d1f6e2cfe2 fixed vararg functions with format argument to not use wxString or reference argument (the latter is invalid C++, the former doesn't work with Watcom and produces at least warnings with GCC 3.3)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45781 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-05-03 10:50:25 +00:00
Václav Slavík
44be939a5e fixed release build compilation with compilers without __VA_ARGS__
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45717 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-30 12:08:01 +00:00
Václav Slavík
82e77a8027 compilation fixes for --disable-log
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45711 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-29 09:02:38 +00:00
Václav Slavík
2523e9b700 use UTF8-encoded char* strings in UTF8 build instead of wchar_t* if the current locale uses UTF8;
fall back to widechar CRT functions in the locale is not UTF8


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45663 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-26 11:40:04 +00:00
Václav Slavík
817270659e initial version of UTF-8 strings representation (still converting to wchar_t* a lot); it has to be explicitly enabled with --enable-utf8 for now
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45433 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-12 21:15:07 +00:00
Václav Slavík
463c2e5bc7 disabled VC6 warning about passing a macro that expands to nothing to DECLARE_LOG_FUNCTION2_IMPL macro
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45090 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-27 10:13:52 +00:00
Václav Slavík
90adbcca75 wxLogGeneric usage compilation fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45028 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-23 09:31:07 +00:00
Vadim Zeitlin
a7f8eb6d0f removed extraneous semicolons
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44990 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-03-20 21:05:09 +00:00