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
This commit is contained in:
@@ -355,7 +355,8 @@ All:
|
|||||||
- Added wxProtocol::SetDefaultTimeout(); the default timeout for both wxHTTP and wxFTP
|
- Added wxProtocol::SetDefaultTimeout(); the default timeout for both wxHTTP and wxFTP
|
||||||
protocols is 60 seconds.
|
protocols is 60 seconds.
|
||||||
- Added wxStrnlen() for safe computation of string length.
|
- Added wxStrnlen() for safe computation of string length.
|
||||||
- Added wxImage::Clear() (troelsk)
|
- Added wxImage::Clear() (troelsk).
|
||||||
|
- Added wxLog::Log().
|
||||||
|
|
||||||
All (Unix):
|
All (Unix):
|
||||||
|
|
||||||
|
@@ -243,6 +243,14 @@ public:
|
|||||||
// change it otherwise)
|
// change it otherwise)
|
||||||
static void TimeStamp(wxString *str);
|
static void TimeStamp(wxString *str);
|
||||||
|
|
||||||
|
// this method should only be called from derived classes DoLog()
|
||||||
|
// implementations and shouldn't be called directly, use logging functions
|
||||||
|
// instead
|
||||||
|
void Log(wxLogLevel level, const wxString& msg, time_t t)
|
||||||
|
{
|
||||||
|
DoLog(level, msg, t);
|
||||||
|
}
|
||||||
|
|
||||||
// make dtor virtual for all derived classes
|
// make dtor virtual for all derived classes
|
||||||
virtual ~wxLog();
|
virtual ~wxLog();
|
||||||
|
|
||||||
@@ -256,7 +264,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// the logging functions that can be overriden
|
// the logging functions that can be overridden
|
||||||
|
|
||||||
// default DoLog() prepends the time stamp and a prefix corresponding
|
// default DoLog() prepends the time stamp and a prefix corresponding
|
||||||
// to the message to szString and then passes it to DoLogString()
|
// to the message to szString and then passes it to DoLogString()
|
||||||
|
@@ -793,7 +793,7 @@ public:
|
|||||||
Forwards the message at specified level to the @e DoLog() function of the
|
Forwards the message at specified level to the @e DoLog() function of the
|
||||||
active log target if there is any, does nothing otherwise.
|
active log target if there is any, does nothing otherwise.
|
||||||
*/
|
*/
|
||||||
static void OnLog(wxLogLevel level, const wxString& szString, time_t t);
|
static void OnLog(wxLogLevel level, const wxString& msg, time_t t);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Remove the @a mask from the list of allowed masks for
|
Remove the @a mask from the list of allowed masks for
|
||||||
@@ -874,6 +874,34 @@ public:
|
|||||||
*/
|
*/
|
||||||
static void Suspend();
|
static void Suspend();
|
||||||
|
|
||||||
|
/**
|
||||||
|
Log the given message.
|
||||||
|
|
||||||
|
This function should only be called from the DoLog() implementations in
|
||||||
|
the derived classes (which can't call wxLog::DoLog() directly as it is
|
||||||
|
protected), it should not be used for logging new messages which can be
|
||||||
|
only sent to the currently active logger using OnLog() which also
|
||||||
|
checks if the logging (for this level) is enabled while this method
|
||||||
|
just directly calls DoLog().
|
||||||
|
|
||||||
|
Example of use of this class from wxLogChain:
|
||||||
|
@code
|
||||||
|
void wxLogChain::DoLog(wxLogLevel level, const wxString& msg, time_t t)
|
||||||
|
{
|
||||||
|
// let the previous logger show it
|
||||||
|
if ( m_logOld && IsPassingMessages() )
|
||||||
|
m_logOld->Log(level, msg, t);
|
||||||
|
|
||||||
|
// and also send it to the new one
|
||||||
|
if ( m_logNew && m_logNew != this )
|
||||||
|
m_logNew->Log(level, msg, t);
|
||||||
|
}
|
||||||
|
@endcode
|
||||||
|
|
||||||
|
@since 2.9.0
|
||||||
|
*/
|
||||||
|
void Log(wxLogLevel level, const wxString& msg, time_t timestamp);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -915,16 +915,11 @@ void wxLogChain::DoLog(wxLogLevel level, const wxString& szString, time_t t)
|
|||||||
{
|
{
|
||||||
// let the previous logger show it
|
// let the previous logger show it
|
||||||
if ( m_logOld && IsPassingMessages() )
|
if ( m_logOld && IsPassingMessages() )
|
||||||
{
|
m_logOld->Log(level, szString, t);
|
||||||
// bogus cast just to access protected DoLog
|
|
||||||
((wxLogChain *)m_logOld)->DoLog(level, szString, t);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// and also send it to the new one
|
||||||
if ( m_logNew && m_logNew != this )
|
if ( m_logNew && m_logNew != this )
|
||||||
{
|
m_logNew->Log(level, szString, t);
|
||||||
// as above...
|
|
||||||
((wxLogChain *)m_logNew)->DoLog(level, szString, t);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __VISUALC__
|
#ifdef __VISUALC__
|
||||||
|
Reference in New Issue
Block a user