[Libreoffice-commits] .: 2 commits - desktop/source sal/inc sal/osl
Stephan Bergmann
sbergmann at kemper.freedesktop.org
Wed Apr 4 06:26:53 PDT 2012
desktop/source/app/app.cxx | 3 +--
sal/inc/sal/detail/log.h | 3 +--
sal/inc/sal/log.hxx | 23 +++++++++++------------
sal/osl/all/log.cxx | 5 +++--
4 files changed, 16 insertions(+), 18 deletions(-)
New commits:
commit 7d96faeacd284ca30a04f6a5af06f06c5cc02c36
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Apr 4 15:25:06 2012 +0200
Improved error reporting
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 01d1c7d..156e8b5 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -702,8 +702,7 @@ void Desktop::ensureProcessServiceFactory()
}
catch (const css::uno::Exception& e)
{
- (void)e;
- OSL_FAIL(rtl::OUStringToOString(e.Message, osl_getThreadTextEncoding()).getStr());
+ SAL_WARN("desktop", "UNO Exception: " << e.Message);
// let exceptions escape and tear down the process, it is
// completely broken anyway
throw;
commit 09be30729e081a636886ffadc3179469098c5512
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Apr 4 15:24:16 2012 +0200
Minor tweakings
diff --git a/sal/inc/sal/detail/log.h b/sal/inc/sal/detail/log.h
index bb3d4c6..3787ada 100644
--- a/sal/inc/sal/detail/log.h
+++ b/sal/inc/sal/detail/log.h
@@ -72,8 +72,7 @@ extern "C" {
enum sal_detail_LogLevel {
SAL_DETAIL_LOG_LEVEL_INFO, SAL_DETAIL_LOG_LEVEL_WARN,
- SAL_DETAIL_LOG_LEVEL_DEBUG,
- SAL_DETAIL_MAKE_FIXED_SIZE = SAL_MAX_ENUM
+ SAL_DETAIL_LOG_LEVEL_DEBUG = SAL_MAX_ENUM
};
SAL_DLLPUBLIC void SAL_CALL sal_detail_logFormat(
diff --git a/sal/inc/sal/log.hxx b/sal/inc/sal/log.hxx
index bb41a6f..033edb9 100644
--- a/sal/inc/sal/log.hxx
+++ b/sal/inc/sal/log.hxx
@@ -188,25 +188,24 @@ inline char const * unwrapStream(SAL_UNUSED_PARAMETER StreamIgnore const &) {
SAL_INFO(char const * area, expr),
SAL_INFO_IF(bool condition, char const * area, expr),
SAL_WARN(char const * area, expr),
- SAL_WARN_IF(bool condition, char const * area, expr), and
- SAL_DEBUG(expr) produce an info resp.
- warning log entry with a message produced by piping items into a C++
- std::ostringstream. The given expr must be so that the full expression
- "stream << expr" is valid, where stream is a variable of type
- std::ostringstream.
+ SAL_WARN_IF(bool condition, char const * area, expr), and SAL_DEBUG(expr)
+ produce an info, warning, or debug log entry with a message produced by
+ piping items into a C++ std::ostringstream. The given expr must be so that
+ the full expression "stream << expr" is valid, where stream is a variable of
+ type std::ostringstream.
SAL_INFO("foo", "string " << s << " of length " << n)
would be an example of such a call.
- In the composed message should be in UTF-8 and it should
- contain no vertical formatting characters and no null characters
+ The composed message should be in UTF-8 and it should contain no vertical
+ formatting characters and no null characters
For the _IF variants, log output is only generated if the given condition is
true (in addition to the other conditions that have to be met).
The SAL_DEBUG macro is for temporary debug statements that are used while
- working on code. It is never meant to remain in the code. It will always
+ working on code. It is never meant to remain in the code. It will always
simply output the given expression in debug builds.
For all the other macros, the given area argument must be non-null and must
@@ -314,14 +313,14 @@ inline char const * unwrapStream(SAL_UNUSED_PARAMETER StreamIgnore const &) {
::SAL_DETAIL_LOG_LEVEL_WARN, area, SAL_WHERE, stream)
/**
- Produce temporary debugging output from stream. This macro is meant
- to be used only while working on code and should never exist in production code.
+ Produce temporary debugging output from stream. This macro is meant to be
+ used only while working on code and should never exist in production code.
See @ref sal_log "basic logging functionality" for details.
*/
#define SAL_DEBUG(stream) \
SAL_DETAIL_LOG_STREAM( \
- SAL_LOG_TRUE, ::SAL_DETAIL_LOG_LEVEL_DEBUG, NULL, SAL_WHERE, stream)
+ SAL_LOG_TRUE, ::SAL_DETAIL_LOG_LEVEL_DEBUG, 0, 0, stream)
#endif
diff --git a/sal/osl/all/log.cxx b/sal/osl/all/log.cxx
index 43d7045..bac0e93 100644
--- a/sal/osl/all/log.cxx
+++ b/sal/osl/all/log.cxx
@@ -156,12 +156,13 @@ void log(
char const * message)
{
std::ostringstream s;
- if (level == SAL_DETAIL_LOG_LEVEL_DEBUG)
+ if (level == SAL_DETAIL_LOG_LEVEL_DEBUG) {
s << toString(level) << ':' << /*no where*/' ' << message << '\n';
- else
+ } else {
s << toString(level) << ':' << area << ':' << OSL_DETAIL_GETPID << ':'
<< osl::Thread::getCurrentIdentifier() << ':' << where << message
<< '\n';
+ }
std::fputs(s.str().c_str(), stderr);
}
More information about the Libreoffice-commits
mailing list