Make wxLogInfo() work even without wxLog::SetVerbose()
It's confusing that wxLogInfo() and wxLogVerbose() are exactly the same and the former, and not only the latter, doesn't do anything unless SetVerbose() had been called, even if the log level is wxLOG_Info or higher. Fix this by checking for GetVerbose() in wxLogVerbose() only and making wxLogInfo() check the log level only. This makes it very similar to wxLogMessage() but this is not such a bad thing. Also improve wxLogVerbose() documentation.
This commit is contained in:
parent
7c32ef2ba3
commit
da7388c9c8
@ -59,6 +59,8 @@ All:
|
||||
|
||||
- Add support for the micro version (third component) to OS and toolkit version
|
||||
functions. See wxGetOsVersion(), wxPlatformInfo, and wxAppTraits.
|
||||
- wxLogInfo() now logs messages if the log level is high enough, even without
|
||||
wxLog::SetVerbose() which now only affects wxLogVerbose().
|
||||
|
||||
wxMSW:
|
||||
|
||||
|
@ -1272,6 +1272,10 @@ WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0);
|
||||
#define wxLogMessage wxDO_LOG_IF_ENABLED(Message)
|
||||
#define wxVLogMessage(format, argptr) wxDO_LOGV(Message, format, argptr)
|
||||
|
||||
#define wxLogInfo wxDO_LOG_IF_ENABLED(Info)
|
||||
#define wxVLogInfo(format, argptr) wxDO_LOGV(Info, format, argptr)
|
||||
|
||||
|
||||
// this one is special as it only logs if we're in verbose mode
|
||||
#define wxLogVerbose \
|
||||
if ( !(wxLog::IsLevelEnabled(wxLOG_Info, wxLOG_COMPONENT) && \
|
||||
@ -1286,11 +1290,6 @@ WXDLLIMPEXP_BASE const wxChar* wxSysErrorMsg(unsigned long nErrCode = 0);
|
||||
else \
|
||||
wxDO_LOGV(Info, format, argptr)
|
||||
|
||||
// deprecated synonyms for wxLogVerbose() and wxVLogVerbose()
|
||||
#define wxLogInfo wxLogVerbose
|
||||
#define wxVLogInfo wxVLogVerbose
|
||||
|
||||
|
||||
// another special case: the level is passed as first argument of the function
|
||||
// and so is not available to the macro
|
||||
//
|
||||
|
@ -1261,9 +1261,31 @@ void wxVLogMessage(const char* formatString, va_list argPtr);
|
||||
/** @addtogroup group_funcmacro_log */
|
||||
//@{
|
||||
/**
|
||||
For verbose output. Normally, it is suppressed, but might be activated if
|
||||
the user wishes to know more details about the program progress (another,
|
||||
but possibly confusing name for the same function could be @c wxLogInfo).
|
||||
For low priority messages.
|
||||
|
||||
They are handled in the same way as messages logged by wxLogMessage() by
|
||||
the default logger but could be handled differently by the custom loggers.
|
||||
|
||||
@header{wx/log.h}
|
||||
*/
|
||||
void wxLogInfo(const char* formatString, ... );
|
||||
void wxVLogInfo(const char* formatString, va_list argPtr);
|
||||
//@}
|
||||
|
||||
/** @addtogroup group_funcmacro_log */
|
||||
//@{
|
||||
/**
|
||||
For verbose output.
|
||||
|
||||
Messages generated by these functions are suppressed by default, even if
|
||||
the log level is higher than ::wxLOG_Info and need to be explicitly
|
||||
activated by calling wxLog::SetVerbose().
|
||||
|
||||
Notice that this is done automatically by wxWidgets, unless the standard
|
||||
command line handling is overridden, if @c --verbose option is specified on
|
||||
the program command line, so using these functions provides a simple way of
|
||||
having some diagnostic messages not shown by default but which can be
|
||||
easily shown by the user if needed.
|
||||
|
||||
@header{wx/log.h}
|
||||
*/
|
||||
|
@ -341,7 +341,6 @@ void wxLogGui::DoLogRecord(wxLogLevel level,
|
||||
switch ( level )
|
||||
{
|
||||
case wxLOG_Info:
|
||||
if ( GetVerbose() )
|
||||
case wxLOG_Message:
|
||||
{
|
||||
m_aMessages.Add(msg);
|
||||
|
Loading…
Reference in New Issue
Block a user