summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorAndreas Schlüns <as@openoffice.org>2001-02-01 08:15:03 +0000
committerAndreas Schlüns <as@openoffice.org>2001-02-01 08:15:03 +0000
commitcdc52ceb4aedd6d67caf9ab78ef7c13a846ce8b7 (patch)
tree9099a33709b0b57304a36a28b795300af809db78 /framework
parente742726098cb9ee2981a0689612b904249750e1b (diff)
new macro to log exceptions
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/macros/debug/assertion.hxx79
1 files changed, 74 insertions, 5 deletions
diff --git a/framework/inc/macros/debug/assertion.hxx b/framework/inc/macros/debug/assertion.hxx
index e2c97ea4a05c..76bf03ec62ac 100644
--- a/framework/inc/macros/debug/assertion.hxx
+++ b/framework/inc/macros/debug/assertion.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: assertion.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:29:23 $
+ * last change: $Author: as $ $Date: 2001-02-01 09:15:03 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -76,6 +76,10 @@
#include <osl/diagnose.h>
#endif
+ #ifndef _RTL_USTRBUF_HXX_
+ #include <rtl/ustrbuf.hxx>
+ #endif
+
/*_____________________________________________________________________________________________________________
LOGFILE_ASSERTIONS
@@ -87,6 +91,8 @@
"assertions.log"
#endif
+ #if LOGTYPE==LOGTYPE_FILECONTINUE
+
/*_____________________________________________________________________________________________________________
LOG_ASSERT( BCONDITION, STEXT )
@@ -95,14 +101,35 @@
BCONDITION is inserted in "(...)" because user can call this macro with an complex expression!
_____________________________________________________________________________________________________________*/
- #if LOGTYPE==LOGTYPE_FILECONTINUE
#define LOG_ASSERT( BCONDITION, STEXT ) \
if ( ( BCONDITION ) == sal_False ) \
{ \
WRITE_LOGFILE( LOGFILE_ASSERTIONS, STEXT ) \
}
+
+ /*_____________________________________________________________________________________________________________
+ LOG_EXCEPTION( SMETHOD, SOWNMESSAGE, SEXCEPTIONMESSAGE )
+
+ Forward information about occured exception into logfile and continue with program.
+ Set LOGTYPE to LOGTYPE_FILECONTINUE to do this.
+ _____________________________________________________________________________________________________________*/
+
+ #define LOG_EXCEPTION( SMETHOD, SOWNMESSAGE, SEXCEPTIONMESSAGE ) \
+ { \
+ ::rtl::OUStringBuffer sBuffer( 1000 ); \
+ sBuffer.appendAscii ( SMETHOD ); \
+ sBuffer.appendAscii ( "\n" ); \
+ sBuffer.appendAscii ( SOWNMESSAGE ); \
+ sBuffer.appendAscii ( "\n" ); \
+ sBuffer.append ( SEXCEPTIONMESSAGE ); \
+ sBuffer.appendAscii ( "\n" ); \
+ WRITE_LOGFILE( LOGFILE_ASSERTIONS, U2B(sBuffer.makeStringAndClear()).getStr() ) \
+ }
+
#endif
+ #if LOGTYPE==LOGTYPE_FILEXIT
+
/*_____________________________________________________________________________________________________________
LOG_ASSERT( BCONDITION, STEXT )
@@ -111,15 +138,37 @@
BCONDITION is inserted in "(...)" because user can call this macro with an complex expression!
_____________________________________________________________________________________________________________*/
- #if LOGTYPE==LOGTYPE_FILEXIT
#define LOG_ASSERT( BCONDITION, STEXT ) \
if ( ( BCONDITION ) == sal_False ) \
{ \
WRITE_LOGFILE( LOGFILE_ASSERTIONS, STEXT ) \
exit(-1); \
}
+
+ /*_____________________________________________________________________________________________________________
+ LOG_EXCEPTION( SMETHOD, SOWNMESSAGE, SEXCEPTIONMESSAGE )
+
+ Forward information about occured exception into logfile and exit the program.
+ Set LOGTYPE to LOGTYPE_FILECONTINUE to do this.
+ _____________________________________________________________________________________________________________*/
+
+ #define LOG_EXCEPTION( SMETHOD, SOWNMESSAGE, SEXCEPTIONMESSAGE ) \
+ { \
+ ::rtl::OUStringBuffer sBuffer( 1000 ); \
+ sBuffer.appendAscii ( SMETHOD ); \
+ sBuffer.appendAscii ( "\n" ); \
+ sBuffer.appendAscii ( SOWNMESSAGE ); \
+ sBuffer.appendAscii ( "\n" ); \
+ sBuffer.append ( SEXCEPTIONMESSAGE ); \
+ sBuffer.appendAscii ( "\n" ); \
+ WRITE_LOGFILE( LOGFILE_ASSERTIONS, U2B(sBuffer.makeStringAndClear()).getStr() ) \
+ exit(-1); \
+ }
+
#endif
+ #if LOGTYPE==LOGTYPE_MESSAGEBOX
+
/*_____________________________________________________________________________________________________________
LOG_ASSERT( BCONDITION, STEXT )
@@ -128,9 +177,28 @@
BCONDITION is inserted in "(...)" because user can call this macro with an complex expression!
_____________________________________________________________________________________________________________*/
- #if LOGTYPE==LOGTYPE_MESSAGEBOX
#define LOG_ASSERT( BCONDITION, STEXT ) \
OSL_ENSHURE( ( BCONDITION ), STEXT );
+
+ /*_____________________________________________________________________________________________________________
+ LOG_EXCEPTION( SMETHOD, SOWNMESSAGE, SEXCEPTIONMESSAGE )
+
+ Forward information about occured exception into messagebox.
+ Set LOGTYPE to LOGTYPE_FILECONTINUE to do this.
+ _____________________________________________________________________________________________________________*/
+
+ #define LOG_EXCEPTION( SMETHOD, SOWNMESSAGE, SEXCEPTIONMESSAGE ) \
+ { \
+ ::rtl::OUStringBuffer sBuffer( 1000 ); \
+ sBuffer.appendAscii ( SMETHOD ); \
+ sBuffer.appendAscii ( "\n" ); \
+ sBuffer.appendAscii ( SOWNMESSAGE ); \
+ sBuffer.appendAscii ( "\n" ); \
+ sBuffer.append ( SEXCEPTIONMESSAGE ); \
+ sBuffer.appendAscii ( "\n" ); \
+ OSL_ENSHURE( sal_False, U2B(sBuffer.makeStringAndClear()).getStr() ); \
+ }
+
#endif
#else // #ifdef ENABLE_ASSERTIONS
@@ -141,6 +209,7 @@
#undef LOGFILE_ASSERTIONS
#define LOG_ASSERT( BCONDITION, STEXT )
+ #define LOG_EXCEPTION( SMETHOD, SOWNMESSAGE, SEXCEPTIONMESSAGE )
#endif // #ifdef ENABLE_ASSERTIONS