-// implementation of Log functions
-//
-// NB: unfortunately we need all these distinct functions, we can't make them
-// macros and not all compilers inline vararg functions.
-// ----------------------------------------------------------------------------
-
-// log functions can't allocate memory (LogError("out of memory...") should
-// work!), so we use a static buffer for all log messages
-#define LOG_BUFFER_SIZE (4096)
-
-// static buffer for error messages (@@@ MT-unsafe)
-static char s_szBuf[LOG_BUFFER_SIZE];
-
-// generic log function
-void wxLogGeneric(wxLogLevel level, const char *szFormat, ...)
-{
- if ( wxLog::GetActiveTarget() != NULL ) {
- va_list argptr;
- va_start(argptr, szFormat);
- vsprintf(s_szBuf, szFormat, argptr);
- va_end(argptr);
-
- wxLog::OnLog(level, s_szBuf);
- }
-}
-
-#define IMPLEMENT_LOG_FUNCTION(level) \
- void wxLog##level(const char *szFormat, ...) \
- { \
- if ( wxLog::GetActiveTarget() != NULL ) { \
- va_list argptr; \
- va_start(argptr, szFormat); \
- vsprintf(s_szBuf, szFormat, argptr); \
- va_end(argptr); \
- \
- wxLog::OnLog(wxLOG_##level, s_szBuf); \
- } \
- }
-
-IMPLEMENT_LOG_FUNCTION(FatalError)
-IMPLEMENT_LOG_FUNCTION(Error)
-IMPLEMENT_LOG_FUNCTION(Warning)
-IMPLEMENT_LOG_FUNCTION(Message)
-IMPLEMENT_LOG_FUNCTION(Info)
-IMPLEMENT_LOG_FUNCTION(Status)
-
-// accepts an additional argument which tells to which frame the output should
-// be directed
-void wxLogStatus(wxFrame *pFrame, const char *szFormat, ...)
-{
- wxLog *pLog = wxLog::GetActiveTarget();
- if ( pLog != NULL ) {
- va_list argptr;
- va_start(argptr, szFormat);
- vsprintf(s_szBuf, szFormat, argptr);
- va_end(argptr);
-
- wxASSERT( gs_pFrame == NULL ); // should be reset!
- gs_pFrame = pFrame;
- wxLog::OnLog(wxLOG_Status, s_szBuf);
- gs_pFrame = (wxFrame *) NULL;
- }
-}
-
-// same as info, but only if 'verbose' mode is on
-void wxLogVerbose(const char *szFormat, ...)
-{
- wxLog *pLog = wxLog::GetActiveTarget();
- if ( pLog != NULL && pLog->GetVerbose() ) {
- va_list argptr;
- va_start(argptr, szFormat);
- vsprintf(s_szBuf, szFormat, argptr);
- va_end(argptr);
-
- wxLog::OnLog(wxLOG_Info, s_szBuf);
- }
-}
-
-// debug functions
-#ifdef __WXDEBUG__
-#define IMPLEMENT_LOG_DEBUG_FUNCTION(level) \
- void wxLog##level(const char *szFormat, ...) \
- { \
- if ( wxLog::GetActiveTarget() != NULL ) { \
- va_list argptr; \
- va_start(argptr, szFormat); \
- vsprintf(s_szBuf, szFormat, argptr); \
- va_end(argptr); \
- \
- wxLog::OnLog(wxLOG_##level, s_szBuf); \
- } \
- }
-
- void wxLogTrace(wxTraceMask mask, const char *szFormat, ...)
- {
- wxLog *pLog = wxLog::GetActiveTarget();
-
- // we check that all of mask bits are set in the current mask, so
- // that wxLogTrace(wxTraceRefCount | wxTraceOle) will only do something
- // if both bits are set.
- if ( pLog != NULL && ((pLog->GetTraceMask() & mask) == mask) ) {
- va_list argptr;
- va_start(argptr, szFormat);
- vsprintf(s_szBuf, szFormat, argptr);
- va_end(argptr);
-
- wxLog::OnLog(wxLOG_Trace, s_szBuf);
- }
- }
-
-#else // release
- #define IMPLEMENT_LOG_DEBUG_FUNCTION(level)
-#endif