Commit Graph

178 Commits

Author SHA1 Message Date
Vadim Zeitlin
ff46415213 Compilation fix for wxUSE_LOG_DEBUG==0 case.
Don't do anything in wxDISABLE_DEBUG_LOGGING_IN_RELEASE_BUILD() if we don't
use debug logging anyhow.

Closes #12070.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64333 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-05-18 10:29:52 +00:00
Vadim Zeitlin
55e5154d2c Make calling wxLog::IsAllowedTraceMask() safe during static init time.
Although using wxLog during statics initialization is not recommended, it may
still happen, possibly indirectly so make it work correctly by using an
accessor function for the array of trace masks which ensures that this array
is always correctly initialized before being used.

Closes #11592.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63063 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-01-04 12:22:42 +00:00
Vadim Zeitlin
7d9550df50 Define wxDEBUG_LEVEL in both debug and release builds as 1.
By default include assertions and debug logging in both debug and release
builds but disable them in application release builds (when NDEBUG is
defined).

Also update (more accurately, replace) debugging overview.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61886 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-09-12 11:28:52 +00:00
Vadim Zeitlin
03647350fc No changes, just removed hard tabs and trailing white space.
This commit is huge but there are no non-white-space changes in it.

Some files containing third-party sources (src/msw/wince/time.cpp,
src/x11/pango*.cpp) were left unchanged.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61724 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-08-21 10:41:26 +00:00
Vadim Zeitlin
b0d58b0ea8 Fix compilation for wxUSE_LOG==0.
Move wxObject and wxFrame forward declarations so that they are accessible to
empty wxLogXXX() functions defined in wxUSE_LOG==0 case too.

Also take wxFormatString, not wxString, in these functions to avoid overload
ambiguities.

Closes #11103.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61693 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-08-18 01:22:57 +00:00
Vadim Zeitlin
b804f9924d Fix last error display in wxLogSysError().
After recent changes of wxLogXXX() functions into macros the last error was
overwritten by wxString::Format() called between the call to wxLogSysError()
and wxLog::CallDoLogNow() which called wxSysErrorCode() and so its original
value was lost and, unless the last error was specified explicitly, it always
came out as 0.

To fix this, call wxSysErrorCode() directly when calling wxLogSysError(). This
may be unnecessary (if the error is given explicitly) but there doesn't seem
to be any other way to fix it and the overhead of calling wxSysErrorCode()
shouldn't be that big.

Also add a unit test checking that wxLogSysError() behaves as expected.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61692 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-08-18 01:22:48 +00:00
Vadim Zeitlin
89d62794e4 Implement wxVLogTrace() accidentally removed by recent changes.
Also change the unit test to test wxVLogTrace() as well as wxLogTrace.

Closes #11011.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61505 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-23 13:40:44 +00:00
Vadim Zeitlin
e55919d892 No changes, just fix a typo: wxGuiLog was used instead of wxLogGui.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61449 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-18 11:18:21 +00:00
Vadim Zeitlin
5d7526b0b8 fix log target auto creation broken by recent changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61432 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-15 12:36:09 +00:00
Vadim Zeitlin
53ff8df7d5 Make wxLog::EnableLogging() and wxLogNull thread-specific.
Disabling logging in a single thread (even the main one) shouldn't disable
logs from the background threads which should disable their logging themselves
as/if needed.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61423 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-13 13:21:52 +00:00
Vadim Zeitlin
acad886cb4 Add support for thread-specific log targets.
A worker thread can now have its own log target which will be used directly
by the log functions instead of buffering log output in the main thread; the
GUI thread in the thread sample shows how it works.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61422 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-13 11:09:26 +00:00
Vadim Zeitlin
16b1f6fc50 Removed critical section protecting last repeat counter.
It is not needed any longer now that this is only used by
wxLog::OnLogInMainThreade() which is only called from the main thread.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61417 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-12 17:09:33 +00:00
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