summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2011-11-23 15:45:43 +0100
committerStephan Bergmann <sbergman@redhat.com>2011-11-23 15:50:58 +0100
commit0c7bff02710f8ad7915e215f723b6abad0079221 (patch)
tree30ddfb6fedcd954f91bfa24f36df1dd7413804c4
parentf4573ceb2965ccc8abc1f5165b0fa63f5d63649f (diff)
Changed sal/log.h -> sal/log.hxx, drop _S from C++ streaming log macros.
A compile time check ensures the common case of streaming just a plain C-style string literal still produces reasonably compact call-site code. The format-string variants are still available in sal/detail/log.h, but only to be used in obsolete osl/diagnose.h etc., and going to be removed again eventually.
-rw-r--r--avmedia/source/viewer/mediawindowbase_impl.cxx6
-rw-r--r--basic/source/app/app.cxx4
-rw-r--r--basic/source/sbx/sbxbase.cxx6
-rw-r--r--basic/source/uno/namecont.cxx18
-rw-r--r--canvas/inc/canvas/verbosetrace.hxx5
-rw-r--r--desktop/source/deployment/registry/dp_backend.cxx6
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/diagnostics.h8
-rw-r--r--sal/inc/osl/diagnose.h17
-rw-r--r--sal/inc/osl/diagnose.hxx2
-rw-r--r--sal/inc/rtl/string.hxx2
-rw-r--r--sal/inc/rtl/ustring.hxx2
-rw-r--r--sal/inc/sal/detail/log.h111
-rw-r--r--sal/inc/sal/log.hxx (renamed from sal/inc/sal/log.h)203
-rw-r--r--sal/osl/all/log.cxx3
-rw-r--r--sal/osl/all/logformat.hxx2
-rw-r--r--sal/osl/all/trace.cxx3
-rw-r--r--sal/osl/unx/conditn.cxx (renamed from sal/osl/unx/conditn.c)87
-rw-r--r--sal/prj/d.lst3
-rw-r--r--sal/rtl/source/logfile.cxx6
-rw-r--r--sfx2/source/appl/module.cxx4
-rw-r--r--sfx2/source/control/bindings.cxx6
-rw-r--r--sfx2/source/control/dispatch.cxx4
-rw-r--r--sfx2/source/control/shell.cxx6
-rw-r--r--svl/source/items/poolio.cxx6
-rw-r--r--svl/source/items/whassert.hxx4
-rw-r--r--sw/source/ui/docvw/srcedtw.cxx4
-rw-r--r--tools/inc/tools/debug.hxx31
-rw-r--r--tools/source/debug/debug.cxx16
-rw-r--r--tools/source/rc/resmgr.cxx4
-rwxr-xr-xvcl/source/app/dbggui.cxx2
30 files changed, 339 insertions, 242 deletions
diff --git a/avmedia/source/viewer/mediawindowbase_impl.cxx b/avmedia/source/viewer/mediawindowbase_impl.cxx
index 97f36cef5b91..c6b46aff133d 100644
--- a/avmedia/source/viewer/mediawindowbase_impl.cxx
+++ b/avmedia/source/viewer/mediawindowbase_impl.cxx
@@ -31,7 +31,7 @@
#include "mediamisc.hxx"
#include "mediawindow.hrc"
#include <rtl/oustringostreaminserter.hxx>
-#include <sal/log.h>
+#include <sal/log.hxx>
#include <tools/urlobj.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -83,14 +83,14 @@ uno::Reference< media::XPlayer > MediaWindowBaseImpl::createPlayer( const ::rtl:
xManager->createPlayer( rURL ), uno::UNO_QUERY );
}
else
- SAL_WARN_S(
+ SAL_WARN(
"avmedia",
("failed to create media player service "
AVMEDIA_MANAGER_SERVICE_NAME));
}
catch( const uno::Exception &e )
{
- SAL_WARN_S(
+ SAL_WARN(
"avmedia",
"couldn't create media player " AVMEDIA_MANAGER_SERVICE_NAME
", exception '" << e.Message << '\'');
diff --git a/basic/source/app/app.cxx b/basic/source/app/app.cxx
index 71bde6baa5d2..8c93716ba940 100644
--- a/basic/source/app/app.cxx
+++ b/basic/source/app/app.cxx
@@ -72,7 +72,7 @@
#include <rtl/oustringostreaminserter.hxx>
#include <rtl/strbuf.hxx>
-#include <sal/log.h>
+#include <sal/log.hxx>
using namespace comphelper;
using namespace cppu;
@@ -1852,7 +1852,7 @@ String BasicFrame::GenRealString( const String &aResString )
}
else
{
- SAL_WARN_S(
+ SAL_WARN(
"basic",
"Unknown replacement in String: "
<< rtl::OUString(aResult.Copy(nStart, nEnd - nStart)));
diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx
index fa831ab36bd6..d1cf0d516c24 100644
--- a/basic/source/sbx/sbxbase.cxx
+++ b/basic/source/sbx/sbxbase.cxx
@@ -39,7 +39,7 @@
#include <rtl/instance.hxx>
#include <rtl/oustringostreaminserter.hxx>
-#include <sal/log.h>
+#include <sal/log.hxx>
// AppData-Structure for SBX:
@@ -213,7 +213,7 @@ SbxBase* SbxBase::Create( sal_uInt16 nSbxId, sal_uInt32 nCreator )
if( pNew )
break;
}
- SAL_WARN_IF_S(!pNew, "basic", "No factory for SBX ID " << nSbxId);
+ SAL_WARN_IF(!pNew, "basic", "No factory for SBX ID " << nSbxId);
return pNew;
}
@@ -227,7 +227,7 @@ SbxObject* SbxBase::CreateObject( const rtl::OUString& rClass )
if( pNew )
break;
}
- SAL_WARN_IF_S(!pNew, "basic", "No factory for object class " << rClass);
+ SAL_WARN_IF(!pNew, "basic", "No factory for object class " << rClass);
return pNew;
}
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 5815e61867ba..c8e9608c6de1 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -40,7 +40,7 @@
#include <rtl/oustringostreaminserter.hxx>
#include <rtl/uri.hxx>
#include <rtl/strbuf.hxx>
-#include <sal/log.h>
+#include <sal/log.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/anytostring.hxx>
@@ -822,12 +822,12 @@ sal_Bool SfxLibraryContainer::init_Impl(
}
catch ( const xml::sax::SAXException& e )
{
- SAL_WARN_S("basic", e.Message);
+ SAL_WARN("basic", e.Message);
return sal_False;
}
catch ( const io::IOException& e )
{
- SAL_WARN_S("basic", e.Message);
+ SAL_WARN("basic", e.Message);
return sal_False;
}
@@ -915,7 +915,7 @@ sal_Bool SfxLibraryContainer::init_Impl(
{
#if OSL_DEBUG_LEVEL > 0
Any aError( ::cppu::getCaughtException() );
- SAL_WARN_S(
+ SAL_WARN(
"basic",
"couldn't open sub storage for library \""
<< rLib.aName << "\". Exception: "
@@ -1405,7 +1405,7 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
if( !isLibraryElementValid( pLib->getByName( aElementName ) ) )
{
- SAL_WARN_S(
+ SAL_WARN(
"basic",
"invalid library element \"" << aElementName << '"');
continue;
@@ -1487,7 +1487,7 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
if( !isLibraryElementValid( pLib->getByName( aElementName ) ) )
{
- SAL_WARN_S(
+ SAL_WARN(
"basic",
"invalid library element \"" << aElementName << '"');
continue;
@@ -1904,7 +1904,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
{
#if OSL_DEBUG_LEVEL > 0
Any aError( ::cppu::getCaughtException() );
- SAL_WARN_S(
+ SAL_WARN(
"basic",
"couldn't create sub storage for library \""
<< rLib.aName << "\". Exception: "
@@ -2337,7 +2337,7 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name )
{
#if OSL_DEBUG_LEVEL > 0
Any aError( ::cppu::getCaughtException() );
- SAL_WARN_S(
+ SAL_WARN(
"basic",
"couldn't open sub storage for library \"" << Name
<< "\". Exception: "
@@ -2386,7 +2386,7 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name )
if ( !xInStream.is() )
{
- SAL_WARN_S(
+ SAL_WARN(
"basic",
"couldn't open library element stream - attempted to"
" open library \"" << Name << '"');
diff --git a/canvas/inc/canvas/verbosetrace.hxx b/canvas/inc/canvas/verbosetrace.hxx
index 96e12de23520..f4d2c2eacadf 100644
--- a/canvas/inc/canvas/verbosetrace.hxx
+++ b/canvas/inc/canvas/verbosetrace.hxx
@@ -31,9 +31,10 @@
#include "sal/config.h"
-#include "sal/log.h"
+#include "sal/detail/log.h"
-#define VERBOSE_TRACE(...) SAL_INFO("canvas.level2", __VA_ARGS__)
+#define VERBOSE_TRACE(...) \
+ SAL_DETAIL_INFO_IF_FORMAT(true, "canvas.level2", __VA_ARGS__)
#endif /* INCLUDED_CANVAS_VERBOSETRACE_HXX */
diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx
index 13f3a2abcd79..a4c8bc925bcb 100644
--- a/desktop/source/deployment/registry/dp_backend.cxx
+++ b/desktop/source/deployment/registry/dp_backend.cxx
@@ -34,7 +34,7 @@
#include "rtl/oustringostreaminserter.hxx"
#include "rtl/uri.hxx"
#include "rtl/bootstrap.hxx"
-#include "sal/log.h"
+#include "sal/log.hxx"
#include "osl/file.hxx"
#include "cppuhelper/exc_hlp.hxx"
#include "comphelper/servicedecl.hxx"
@@ -75,7 +75,7 @@ void PackageRegistryBackend::disposing( lang::EventObject const & event )
::osl::MutexGuard guard( getMutex() );
if ( m_bound.erase( url ) != 1 )
{
- SAL_WARN_S("basic", "erase(" << url << ") != 1");
+ SAL_WARN("basic", "erase(" << url << ") != 1");
}
}
@@ -681,7 +681,7 @@ void Package::processPackage_impl(
}
}
catch (RuntimeException &e) {
- SAL_WARN_S(
+ SAL_WARN(
"basic", "unexpected RuntimeException \"" << e.Message << '"');
throw;
}
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/diagnostics.h b/jvmfwk/plugins/sunmajor/pluginlib/diagnostics.h
index eb1cd03c8a8d..fd6b5f312b62 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/diagnostics.h
+++ b/jvmfwk/plugins/sunmajor/pluginlib/diagnostics.h
@@ -32,13 +32,13 @@
#include "sal/config.h"
#include "rtl/oustringostreaminserter.hxx"
-#include "sal/log.h"
+#include "sal/log.hxx"
-#define JFW_ENSURE(c, m) SAL_WARN_IF_S(!(c), "jfw", m)
+#define JFW_ENSURE(c, m) SAL_WARN_IF(!(c), "jfw", m)
-#define JFW_TRACE0(m) SAL_INFO_S("jfw.level1", m)
+#define JFW_TRACE0(m) SAL_INFO("jfw.level1", m)
-#define JFW_TRACE2(m) SAL_INFO_S("jfw.level2", m);
+#define JFW_TRACE2(m) SAL_INFO("jfw.level2", m);
#endif
diff --git a/sal/inc/osl/diagnose.h b/sal/inc/osl/diagnose.h
index 0e1fc443e67e..12357aa9bd61 100644
--- a/sal/inc/osl/diagnose.h
+++ b/sal/inc/osl/diagnose.h
@@ -32,7 +32,7 @@
#include "sal/config.h"
-#include <sal/log.h>
+#include <sal/detail/log.h>
#include <sal/types.h>
/** provides simple diagnostic support
@@ -42,7 +42,7 @@
if an assertion fails, and is controlled by the standard NDEBUG macro).
Logging of warnings (e.g., about malformed input) and traces (e.g., about
steps taken while executing some protocol) should use the facilities
- provided by sal/log.h.
+ provided by (C++ only) sal/log.hxx.
Because the assertion macros (OSL_ASSERT, OSL_ENSURE, OSL_FAIL, OSL_PRECOND,
and OSL_POSTCOND) have been used for true assertions as well as for logged
@@ -139,19 +139,20 @@ pfunc_osl_printDetailedDebugMessage SAL_CALL osl_setDetailedDebugMessageFunc( pf
/* the macro OSL_LOG_PREFIX is intended to be an office internal macro for now
- it is deprecated and superseded by SAL_WHERE
+ it is deprecated and superseded by (C++ only) SAL_WHERE
*/
-#define OSL_LOG_PREFIX SAL_WHERE
+#define OSL_LOG_PREFIX SAL_DETAIL_WHERE
#define OSL_DEBUG_ONLY(s) _OSL_DEBUG_ONLY(s)
#define OSL_TRACE(...) \
- SAL_INFO_IF(OSL_DEBUG_LEVEL > 0, "legacy.osl", __VA_ARGS__)
+ SAL_DETAIL_INFO_IF_FORMAT(OSL_DEBUG_LEVEL > 0, "legacy.osl", __VA_ARGS__)
#if OSL_DEBUG_LEVEL > 0
-#define OSL_ASSERT(c) SAL_WARN_IF(!(c), "legacy.osl", "OSL_ASSERT")
-#define OSL_ENSURE(c, m) SAL_WARN_IF(!(c), "legacy.osl", "%s", m)
-#define OSL_FAIL(m) SAL_WARN_IF(sal_True, "legacy.osl", "%s", m)
+#define OSL_ASSERT(c) \
+ SAL_DETAIL_WARN_IF_FORMAT(!(c), "legacy.osl", "OSL_ASSERT")
+#define OSL_ENSURE(c, m) SAL_DETAIL_WARN_IF_FORMAT(!(c), "legacy.osl", "%s", m)
+#define OSL_FAIL(m) SAL_DETAIL_WARN_IF_FORMAT(sal_True, "legacy.osl", "%s", m)
#else
#define OSL_ASSERT(c) ((void) 0)
#define OSL_ENSURE(c, m) ((void) 0)
diff --git a/sal/inc/osl/diagnose.hxx b/sal/inc/osl/diagnose.hxx
index 42e4b8dd7f2f..45a6fdd3cf7c 100644
--- a/sal/inc/osl/diagnose.hxx
+++ b/sal/inc/osl/diagnose.hxx
@@ -39,7 +39,7 @@
#include "osl/mutex.hxx"
#include "rtl/allocator.hxx"
#include "rtl/instance.hxx"
-#include "sal/log.h"
+#include "sal/log.hxx"
#include "sal/types.h"
namespace osl {
diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx
index 007129a7dc0f..0db8341a8930 100644
--- a/sal/inc/rtl/string.hxx
+++ b/sal/inc/rtl/string.hxx
@@ -37,7 +37,7 @@
#include <rtl/memory.h>
#include <rtl/textenc.h>
#include <rtl/string.h>
-#include "sal/log.h"
+#include "sal/log.hxx"
#if !defined EXCEPTIONS_OFF
#include <new>
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
index ef13dd1da387..868f6dd043cd 100644
--- a/sal/inc/rtl/ustring.hxx
+++ b/sal/inc/rtl/ustring.hxx
@@ -37,7 +37,7 @@
#include <rtl/ustring.h>
#include <rtl/string.hxx>
#include <rtl/memory.h>
-#include "sal/log.h"
+#include "sal/log.hxx"
#if defined EXCEPTIONS_OFF
#include <stdlib.h>
diff --git a/sal/inc/sal/detail/log.h b/sal/inc/sal/detail/log.h
new file mode 100644
index 000000000000..bc51b89b6b14
--- /dev/null
+++ b/sal/inc/sal/detail/log.h
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * [ Copyright (C) 2011 Stephan Bergmann, Red Hat <sbergman@redhat.com> (initial
+ * developer) ]
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef INCLUDED_SAL_DETAIL_LOG_H
+#define INCLUDED_SAL_DETAIL_LOG_H
+
+#include "sal/config.h"
+
+#include "sal/types.h"
+
+/** @internal */
+
+/* This header makes available replacements working in both C and C++ for the
+ obsolete osl/diagnose.h functionality that in turn is used from both C and
+ C++ code and the obsolete tools/debug.hxx and
+ canvas/inc/canvas/verbosetrace.hxx functionality that uses printf-style
+ formatting. Once that obsolete functionality is removed, this header can be
+ removed, too.
+
+ This header uses variadic macros in both C (where they are officially only
+ supported since C99) and C++ (where they are officially only supported since
+ C++11). It appears that all relevant compilers (esp. GCC 4.0 and MS VS 2008
+ Express) already support them in their C and C++ dialects. See also
+ <http://wiki.apache.org/stdcxx/C++0xCompilerSupport>.
+
+ Avoid the use of other sal code in this header as much as possible, so that
+ this code can be called from other sal code without causing endless
+ recursion.
+*/
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+enum sal_detail_LogLevel {
+ SAL_DETAIL_LOG_LEVEL_INFO, SAL_DETAIL_LOG_LEVEL_WARN,
+ SAL_DETAIL_MAKE_FIXED_SIZE = SAL_MAX_ENUM
+};
+
+void SAL_CALL sal_detail_logFormat(
+ enum sal_detail_LogLevel level, char const * area, char const * where,
+ char const * format, ...)
+/* TODO: enabling this will produce a huge amount of -Werror=format errors: */
+#if defined GCC && 0
+ __attribute__((format(printf, 4, 5)))
+#endif
+ ;
+
+#if defined __cplusplus
+}
+#endif
+
+#define SAL_DETAIL_LOG_FORMAT(condition, level, area, where, ...) \
+ do { \
+ if (condition) { \
+ sal_detail_logFormat((level), (area), (where), __VA_ARGS__); \
+ } \
+ } while (sal_False)
+
+#if defined SAL_LOG_INFO
+#define SAL_DETAIL_ENABLE_LOG_INFO sal_True
+#else
+#define SAL_DETAIL_ENABLE_LOG_INFO sal_False
+#endif
+#if defined SAL_LOG_WARN
+#define SAL_DETAIL_ENABLE_LOG_WARN sal_True
+#else
+#define SAL_DETAIL_ENABLE_LOG_WARN sal_False
+#endif
+
+#define SAL_DETAIL_WHERE __FILE__ ":" SAL_STRINGIFY(__LINE__) ": "
+
+#define SAL_DETAIL_INFO_IF_FORMAT(condition, area, ...) \
+ SAL_DETAIL_LOG_FORMAT( \
+ SAL_DETAIL_ENABLE_LOG_INFO && (condition), SAL_DETAIL_LOG_LEVEL_INFO, \
+ area, SAL_DETAIL_WHERE, __VA_ARGS__)
+
+#define SAL_DETAIL_WARN_IF_FORMAT(condition, area, ...) \
+ SAL_DETAIL_LOG_FORMAT( \
+ SAL_DETAIL_ENABLE_LOG_WARN && (condition), SAL_DETAIL_LOG_LEVEL_WARN, \
+ area, SAL_DETAIL_WHERE, __VA_ARGS__)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/inc/sal/log.h b/sal/inc/sal/log.hxx
index d63ed6b32752..be71d021d560 100644
--- a/sal/inc/sal/log.h
+++ b/sal/inc/sal/log.hxx
@@ -27,71 +27,30 @@
* instead of those above.
*/
-#ifndef INCLUDED_SAL_LOG_H
-#define INCLUDED_SAL_LOG_H
+#ifndef INCLUDED_SAL_LOG_HXX
+#define INCLUDED_SAL_LOG_HXX
#include "sal/config.h"
-#if defined __cplusplus
+#include <cstdlib>
#include <sstream>
#include <string>
-#endif
+#include "sal/detail/log.h"
#include "sal/types.h"
-/* This header uses variadic macros in both C (where they are officially only
- supported since C99) and C++ (where they are officially only supported since
- C++11). It appears that all relevant compilers (esp. GCC 4.0 and MS VS 2008
- Express) already support them in their C and C++ dialects. See also
- <http://wiki.apache.org/stdcxx/C++0xCompilerSupport>.
-
- Avoid the use of other sal code in this header as much as possible, so that
- this code can be called from other sal code without causing endless
- recursion.
-*/
-
-#if defined __cplusplus
-extern "C" {
-#endif
-
-/** @internal */
-enum sal_detail_LogLevel {
- SAL_DETAIL_LOG_LEVEL_INFO, SAL_DETAIL_LOG_LEVEL_WARN,
- SAL_DETAIL_MAKE_FIXED_SIZE = SAL_MAX_ENUM
-};
+// Avoid the use of other sal code in this header as much as possible, so that
+// this code can be called from other sal code without causing endless
+// recursion.
-/** @internal */
-void SAL_CALL sal_detail_log(
+/// @internal
+extern "C" void SAL_CALL sal_detail_log(
enum sal_detail_LogLevel level, char const * area, char const * where,
char const * message);
-/** @internal */
-void SAL_CALL sal_detail_logFormat(
- enum sal_detail_LogLevel level, char const * area, char const * where,
- char const * format, ...)
-/* TODO: enabling this will produce a huge amount of -Werror=format errors: */
-#if defined GCC && 0
- __attribute__((format(printf, 4, 5)))
-#endif
- ;
-
-#if defined __cplusplus
-}
-#endif
-
-/** @internal */
-#define SAL_DETAIL_LOG_FORMAT(condition, level, area, where, ...) \
- do { \
- if (condition) { \
- sal_detail_logFormat((level), (area), (where), __VA_ARGS__); \
- } \
- } while (sal_False)
-
-#if defined __cplusplus
-
+/// @internal
namespace sal { namespace detail {
-/// @internal
inline void SAL_CALL log(
sal_detail_LogLevel level, char const * area, char const * where,
std::ostringstream const & stream)
@@ -107,32 +66,72 @@ inline void SAL_CALL log(
sal_detail_log(level, area, where, stream.str().c_str());
}
+// Special handling of the common case where the message consists of just a
+// string literal, to produce smaller call-site code:
+
+struct StreamStart {};
+
+struct StreamString {
+ StreamString(char const * s): string(s) {}
+
+ char const * string;
+
+ typedef char Result;
+};
+
+struct StreamIgnore {
+ typedef struct { char a[2]; } Result;
+};
+
+inline StreamString operator <<(StreamStart const &, char const * s) {
+ return StreamString(s);
+}
+
+template< typename T > inline StreamIgnore operator <<(
+ StreamStart const &, T const &)
+{
+ std::abort();
+}
+
+template< typename T > inline StreamIgnore operator <<(
+ StreamString const &, T const &)
+{
+ std::abort();
+}
+
+template< typename T > inline StreamIgnore operator <<(
+ StreamIgnore const &, T const &)
+{
+ std::abort();
+}
+
+template< typename T > typename T::Result getResult(T const &);
+
+inline char const * unwrapStream(StreamString const & s) { return s.string; }
+
+inline char const * unwrapStream(StreamIgnore const &) { std::abort(); }
+
} }
/// @internal
#define SAL_DETAIL_LOG_STREAM(condition, level, area, where, stream) \
do { \
if (condition) { \
- ::std::ostringstream sal_detail_stream; \
- sal_detail_stream << stream; \
- ::sal::detail::log((level), (area), (where), sal_detail_stream); \
+ if (sizeof getResult(::sal::detail::StreamStart() << stream) == 1) \
+ { \
+ ::sal_detail_log( \
+ (level), (area), (where), \
+ ::sal::detail::unwrapStream( \
+ ::sal::detail::StreamStart() << stream)); \
+ } else { \
+ ::std::ostringstream sal_detail_stream; \
+ sal_detail_stream << stream; \
+ ::sal::detail::log( \
+ (level), (area), (where), sal_detail_stream); \
+ } \
} \
} while (false)
-#endif
-
-/** @internal */
-#if defined SAL_LOG_INFO
-#define SAL_DETAIL_ENABLE_LOG_INFO sal_True
-#else
-#define SAL_DETAIL_ENABLE_LOG_INFO sal_False
-#endif
-#if defined SAL_LOG_WARN
-#define SAL_DETAIL_ENABLE_LOG_WARN sal_True
-#else
-#define SAL_DETAIL_ENABLE_LOG_WARN sal_False
-#endif
-
/** A simple macro to create a "file and line number" string.
Potentially not only useful within the log framework (where it is used
@@ -140,19 +139,16 @@ inline void SAL_CALL log(
@since LibreOffice 3.5
*/
-#define SAL_WHERE __FILE__ ":" SAL_STRINGIFY(__LINE__) ": "
-
-#if defined __cplusplus
+#define SAL_WHERE SAL_DETAIL_WHERE
/** A facility for generating temporary string messages by piping items into a
C++ std::ostringstream.
- This can be useful for example in a call to SAL_INFO_S when depending on
- some boolean condition data of incompatible types shall be streamed into the
+ This can be useful for example in a call to SAL_INFO when depending on some
+ boolean condition data of incompatible types shall be streamed into the
message, as in:
- SAL_INFO_S(
- "foo", "object: " << (hasName ? obj->name : SAL_STREAM(obj)));
+ SAL_INFO("foo", "object: " << (hasName ? obj->name : SAL_STREAM(obj)));
@since LibreOffice 3.5
*/
@@ -160,28 +156,18 @@ inline void SAL_CALL log(
(dynamic_cast< ::std::ostringstream & >(::std::ostringstream() << stream). \
str())
-#endif
-
/** Basic logging functionality.
- SAL_INFO(char const * area, char const * format, ...),
- SAL_INFO_IF(bool condition, char const * area, char const * format, ...),
- SAL_WARN(char const * area, char const * format, ...), and
- SAL_WARN_IF(bool condition, char const * area, char const * format, ...)
- produce an info resp. warning log entry with a printf-style message. The
- given format argument and any following arguments must be so that that
- sequence of arguments would be appropriate for a call to printf.
-
- SAL_INFO_S(char const * area, expr),
- SAL_INFO_IF_S(bool condition, char const * area, expr),
- SAL_WARN_S(char const * area, expr), and
- SAL_WARN_IF_S(bool condition, char const * area, expr) produce an info resp.
+ SAL_INFO(char const * area, expr),
+ SAL_INFO_IF(bool condition, char const * area, expr),
+ SAL_WARN(char const * area, expr), and
+ SAL_WARN_IF(bool condition, char const * area, expr) produce an info resp.
warning log entry with a message produced by piping items into a C++
- std::ostringstream (and are only available in C++). The given expr must be
- so that the full expression "stream << expr" is valid, where stream is a
- variable of type std::ostringstream.
+ 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_S("foo", "string " << s << " of length " << n)
+ SAL_INFO("foo", "string " << s << " of length " << n)
would be an example of such a call; if the given s is of type rtl::OUString,
@@ -252,48 +238,25 @@ inline void SAL_CALL log(
@since LibreOffice 3.5
*/
-#define SAL_INFO(area, ...) \
- SAL_DETAIL_LOG_FORMAT( \
- SAL_DETAIL_ENABLE_LOG_INFO, SAL_DETAIL_LOG_LEVEL_INFO, area, \
- SAL_WHERE, __VA_ARGS__)
-
-#define SAL_INFO_IF(condition, area, ...) \
- SAL_DETAIL_LOG_FORMAT( \
- SAL_DETAIL_ENABLE_LOG_INFO && (condition), SAL_DETAIL_LOG_LEVEL_INFO, \
- area, SAL_WHERE, __VA_ARGS__)
-
-#define SAL_WARN(area, ...) \
- SAL_DETAIL_LOG_FORMAT( \
- SAL_DETAIL_ENABLE_LOG_WARN, SAL_DETAIL_LOG_LEVEL_WARN, area, \
- SAL_WHERE, __VA_ARGS__)
-
-#define SAL_WARN_IF(condition, area, ...) \
- SAL_DETAIL_LOG_FORMAT( \
- SAL_DETAIL_ENABLE_LOG_WARN && (condition), SAL_DETAIL_LOG_LEVEL_WARN, \
- area, SAL_WHERE, __VA_ARGS__)
-
-#if defined __cplusplus
-
-#define SAL_INFO_S(area, stream) \
+#define SAL_INFO(area, stream) \
SAL_DETAIL_LOG_STREAM( \
SAL_DETAIL_ENABLE_LOG_INFO, ::SAL_DETAIL_LOG_LEVEL_INFO, area, \
SAL_WHERE, stream)
-#define SAL_INFO_IF_S(condition, area, stream) \
+#define SAL_INFO_IF(condition, area, stream) \
SAL_DETAIL_LOG_STREAM( \
SAL_DETAIL_ENABLE_LOG_INFO && (condition), \
::SAL_DETAIL_LOG_LEVEL_INFO, area, SAL_WHERE, stream)
-#define SAL_WARN_S(area, stream) \
+#define SAL_WARN(area, stream) \
SAL_DETAIL_LOG_STREAM( \
SAL_DETAIL_ENABLE_LOG_WARN, ::SAL_DETAIL_LOG_LEVEL_WARN, area, \
SAL_WHERE, stream)
-#define SAL_WARN_IF_S(condition, area, stream) \
+#define SAL_WARN_IF(condition, area, stream) \
SAL_DETAIL_LOG_STREAM( \
SAL_DETAIL_ENABLE_LOG_WARN && (condition), \
::SAL_DETAIL_LOG_LEVEL_WARN, area, SAL_WHERE, stream)
-#endif
#endif
diff --git a/sal/osl/all/log.cxx b/sal/osl/all/log.cxx
index be45cf629b81..a43964436842 100644
--- a/sal/osl/all/log.cxx
+++ b/sal/osl/all/log.cxx
@@ -42,7 +42,8 @@
#include "osl/thread.hxx"
#include "rtl/string.h"
-#include "sal/log.h"
+#include "sal/detail/log.h"
+#include "sal/log.hxx"
#include "sal/types.h"
#include "logformat.hxx"
diff --git a/sal/osl/all/logformat.hxx b/sal/osl/all/logformat.hxx
index f4589a7b9f94..bb6ea4cc6bdd 100644
--- a/sal/osl/all/logformat.hxx
+++ b/sal/osl/all/logformat.hxx
@@ -34,7 +34,7 @@
#include <cstdarg>
-#include "sal/log.h"
+#include "sal/detail/log.h"
namespace osl { namespace detail {
diff --git a/sal/osl/all/trace.cxx b/sal/osl/all/trace.cxx
index 835704779452..8fccb44b68d0 100644
--- a/sal/osl/all/trace.cxx
+++ b/sal/osl/all/trace.cxx
@@ -33,7 +33,8 @@
#include <cstdarg>
#include "osl/diagnose.h"
-#include "sal/log.h"
+#include "sal/detail/log.h"
+#include "sal/log.hxx"
#include "logformat.hxx"
diff --git a/sal/osl/unx/conditn.c b/sal/osl/unx/conditn.cxx
index d7ab7131938c..c6417bfb2f7a 100644
--- a/sal/osl/unx/conditn.c
+++ b/sal/osl/unx/conditn.cxx
@@ -31,7 +31,7 @@
#include <assert.h>
#include "system.h"
-#include <sal/log.h>
+#include <sal/log.hxx>
#include <sal/types.h>
#include <osl/conditn.h>
@@ -69,8 +69,9 @@ oslCondition SAL_CALL osl_createCondition()
if ( nRet != 0 )
{
SAL_WARN(
- "sal", "pthread_cond_init failed, errno %d, \"%s\"", nRet,
- strerror(nRet));
+ "sal",
+ "pthread_cond_init failed, errno " << nRet << ", \""
+ << strerror(nRet) << '"');
free(pCond);
return 0;
@@ -80,13 +81,15 @@ oslCondition SAL_CALL osl_createCondition()
if ( nRet != 0 )
{
SAL_WARN(
- "sal", "pthread_mutex_init failed, errno %d, \"%s\"", nRet,
- strerror(nRet));
+ "sal",
+ "pthread_mutex_init failed, errno " << nRet << ", \""
+ << strerror(nRet) << '"');
nRet = pthread_cond_destroy(&pCond->m_Condition);
SAL_WARN_IF(
- nRet != 0, "sal", "pthread_cond_destroy failed, errno %d, \"%s\"",
- nRet, strerror(nRet));
+ nRet != 0, "sal",
+ "pthread_cond_destroy failed, errno " << nRet << ", \""
+ << strerror(nRet) << '"');
free(pCond);
pCond = 0;
@@ -109,12 +112,14 @@ void SAL_CALL osl_destroyCondition(oslCondition Condition)
nRet = pthread_cond_destroy(&pCond->m_Condition);
SAL_WARN_IF(
- nRet != 0, "sal", "pthread_cond_destroy failed, errno %d, \"%s\"",
- nRet, strerror(nRet));
+ nRet != 0, "sal",
+ "pthread_cond_destroy failed, errno " << nRet << ", \""
+ << strerror(nRet) << '"');
nRet = pthread_mutex_destroy(&pCond->m_Lock);
SAL_WARN_IF(
- nRet != 0, "sal", "pthread_mutex_destroy failed, errno %d, \"%s\"",
- nRet, strerror(nRet));
+ nRet != 0, "sal",
+ "pthread_mutex_destroy failed, errno " << nRet << ", \""
+ << strerror(nRet) << '"');
free(Condition);
}
@@ -142,8 +147,9 @@ sal_Bool SAL_CALL osl_setCondition(oslCondition Condition)
if ( nRet != 0 )
{
SAL_WARN(
- "sal", "pthread_mutex_lock failed, errno %d, \"%s\"", nRet,
- strerror(nRet));
+ "sal",
+ "pthread_mutex_lock failed, errno " << nRet << ", \""
+ << strerror(nRet) << '"');
return sal_False;
}
@@ -152,8 +158,9 @@ sal_Bool SAL_CALL osl_setCondition(oslCondition Condition)
if ( nRet != 0 )
{
SAL_WARN(
- "sal", "pthread_cond_broadcast failed, errno %d, \"%s\"", nRet,
- strerror(nRet));
+ "sal",
+ "pthread_cond_broadcast failed, errno " << nRet << ", \""
+ << strerror(nRet) << '"');
return sal_False;
}
@@ -161,8 +168,9 @@ sal_Bool SAL_CALL osl_setCondition(oslCondition Condition)
if ( nRet != 0 )
{
SAL_WARN(
- "sal", "pthread_mutex_unlock failed, errno %d, \"%s\"", nRet,
- strerror(nRet));
+ "sal",
+ "pthread_mutex_unlock failed, errno " << nRet << ", \""
+ << strerror(nRet) << '"');
return sal_False;
}
@@ -191,8 +199,9 @@ sal_Bool SAL_CALL osl_resetCondition(oslCondition Condition)
if ( nRet != 0 )
{
SAL_WARN(
- "sal", "pthread_mutex_lock failed, errno %d, \"%s\"", nRet,
- strerror(nRet));
+ "sal",
+ "pthread_mutex_lock failed, errno " << nRet << ", \""
+ << strerror(nRet) << '"');
return sal_False;
}
@@ -202,8 +211,8 @@ sal_Bool SAL_CALL osl_resetCondition(oslCondition Condition)
if ( nRet != 0 )
{
SAL_WARN(
- "sal", "pthread_mutex_unlock failed, errno %d, \"%s\"", nRet,
- strerror(nRet));
+ "sal", "pthread_mutex_unlock failed, errno " << nRet <<", \""
+ << strerror(nRet) << '"');
return sal_False;
}
@@ -231,8 +240,8 @@ oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const Time
if ( nRet != 0 )
{
SAL_WARN(
- "sal", "pthread_mutex_lock failed, errno %d, \"%s\"", nRet,
- strerror(nRet));
+ "sal", "pthread_mutex_lock failed, errno " << nRet <<", \""
+ << strerror(nRet) << '"');
return osl_cond_result_error;
}
@@ -261,8 +270,8 @@ oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const Time
nRet = pthread_mutex_unlock(&pCond->m_Lock);
SAL_WARN_IF(
nRet != 0, "sal",
- "pthread_mutex_unlock failed, errno %d, \"%s\"",
- nRet, strerror(nRet));
+ "pthread_mutex_unlock failed, errno " << nRet
+ << ", \"" << strerror(nRet) << '"');
return Result;
}
@@ -272,8 +281,8 @@ oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const Time
nRet = pthread_mutex_unlock(&pCond->m_Lock);
SAL_WARN_IF(
nRet != 0, "sal",
- "pthread_mutex_unlock failed, errno %d, \"%s\"",
- nRet, strerror(nRet));
+ "pthread_mutex_unlock failed, errno " << nRet
+ << ", \"" << strerror(nRet) << '"');
return Result;
}
}
@@ -289,14 +298,15 @@ oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const Time
if ( nRet != 0 )
{
SAL_WARN(
- "sal", "pthread_cond_wait failed, errno %d, \"%s\"", nRet,
- strerror(nRet));
+ "sal",
+ "pthread_cond_wait failed, errno " << nRet << ", \""
+ << strerror(nRet) << '"');
Result = osl_cond_result_error;
nRet = pthread_mutex_unlock(&pCond->m_Lock);
SAL_WARN_IF(
nRet != 0, "sal",
- "pthread_mutex_unlock failed, errno %d, \"%s\"", nRet,
- strerror(nRet));
+ "pthread_mutex_unlock failed, errno " << nRet << ", \""
+ << strerror(nRet) << '"');
return Result;
}
@@ -305,8 +315,9 @@ oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const Time
nRet = pthread_mutex_unlock(&pCond->m_Lock);
SAL_WARN_IF(
- nRet != 0, "sal", "pthread_mutex_unlock failed, errno %d, \"%s\"", nRet,
- strerror(nRet));
+ nRet != 0, "sal",
+ "pthread_mutex_unlock failed, errno " << nRet << ", \""
+ << strerror(nRet) << '"');
return Result;
}
@@ -330,15 +341,17 @@ sal_Bool SAL_CALL osl_checkCondition(oslCondition Condition)
nRet = pthread_mutex_lock(&pCond->m_Lock);
SAL_WARN_IF(
- nRet != 0, "sal", "pthread_mutex_lock failed, errno %d, \"%s\"", nRet,
- strerror(nRet));
+ nRet != 0, "sal",
+ "pthread_mutex_lock failed, errno " << nRet << ", \"" << strerror(nRet)
+ << '"');
State = pCond->m_State;
nRet = pthread_mutex_unlock(&pCond->m_Lock);
SAL_WARN_IF(
- nRet != 0, "sal", "pthread_mutex_unlock failed, errno %d, \"%s\"", nRet,
- strerror(nRet));
+ nRet != 0, "sal",
+ "pthread_mutex_unlock failed, errno " << nRet << ", \""
+ << strerror(nRet) << '"');
return State;
}
diff --git a/sal/prj/d.lst b/sal/prj/d.lst
index 5023c576b334..c7f93ed06309 100644
--- a/sal/prj/d.lst
+++ b/sal/prj/d.lst
@@ -1,6 +1,7 @@
mkdir: %_DEST%\bin\cppunit
mkdir: %_DEST%\inc\cppunittester
mkdir: %_DEST%\inc\sal
+mkdir: %_DEST%\inc\sal\detail
mkdir: %_DEST%\inc\osl
mkdir: %_DEST%\inc\rtl
mkdir: %_DEST%\inc\systools
@@ -9,7 +10,9 @@ mkdir: %_DEST%\inc\systools\win32
..\inc\cppunittester\protectorfactory.hxx %_DEST%\inc\protectorfactory.hxx
..\%__SRC%\inc\rtlbootstrap.mk %_DEST%\inc\rtlbootstrap.mk
..\inc\sal\*.h %_DEST%\inc\sal\*.h
+..\inc\sal\log.hxx %_DEST%\inc\sal\log.hxx
..\inc\sal\precppunit.hxx %_DEST%\inc\sal\precppunit.hxx
+..\inc\sal\detail\log.h %_DEST%\inc\sal\detail\log.h
..\%__SRC%\inc\sal\typesizes.h %_DEST%\inc\sal\typesizes.h
..\inc\osl\*.h %_DEST%\inc\osl\*.h
..\inc\osl\*.hxx %_DEST%\inc\osl\*.hxx
diff --git a/sal/rtl/source/logfile.cxx b/sal/rtl/source/logfile.cxx
index c5858c1747b8..a9bf40b5a0ee 100644
--- a/sal/rtl/source/logfile.cxx
+++ b/sal/rtl/source/logfile.cxx
@@ -44,7 +44,7 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/alloc.h>
#include <rtl/instance.hxx>
-#include <sal/log.h>
+#include <sal/log.hxx>
#include "osl/thread.h"
#include <algorithm>
@@ -109,7 +109,7 @@ OUString getFileUrl( const OUString &name )
if ( osl_getFileURLFromSystemPath( name.pData, &aRet.pData )
!= osl_File_E_None )
{
- SAL_WARN_S(
+ SAL_WARN(
"sal", "osl_getFileURLFromSystemPath failed for \"" << name << '"');
}
@@ -185,7 +185,7 @@ void init() {
}
else
{
- SAL_WARN_S(
+ SAL_WARN(
"sal",
"Couldn't open logfile " << o << '(' << e << ')');
}
diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx
index a4fc06dea36e..ad81dfc97332 100644
--- a/sfx2/source/appl/module.cxx
+++ b/sfx2/source/appl/module.cxx
@@ -50,7 +50,7 @@
#include "sfx2/taskpane.hxx"
#include <tools/diagnose_ex.h>
#include <rtl/strbuf.hxx>
-#include <sal/log.h>
+#include <sal/log.hxx>
#define SfxModule
#include "sfxslots.hxx"
@@ -392,7 +392,7 @@ FieldUnit SfxModule::GetModuleFieldUnit( ::com::sun::star::uno::Reference< ::com
SfxPoolItem const * pItem = pModule->GetItem( SID_ATTR_METRIC );
if ( pItem == NULL )
{
- SAL_WARN_S(
+ SAL_WARN(
"sfx2",
"SfxModule::GetFieldUnit: no metric item in the module implemented"
" by '" << typeid(*pModule).name() << "'!");
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx
index ce1d60468c1e..9806290344ff 100644
--- a/sfx2/source/control/bindings.cxx
+++ b/sfx2/source/control/bindings.cxx
@@ -33,7 +33,7 @@
#include <iomanip>
#include <boost/unordered_map.hpp>
-#include <sal/log.h>
+#include <sal/log.hxx>
#include <svl/itempool.hxx>
#include <svl/itemiter.hxx>
#include <svl/eitem.hxx>
@@ -1743,7 +1743,7 @@ IMPL_LINK( SfxBindings, NextJob_Impl, Timer *, pTimer )
sal_uInt16 SfxBindings::EnterRegistrations(const char *pFile, int nLine)
{
DBG_MEMTEST();
- SAL_INFO_S(
+ SAL_INFO(
"sfx2",
std::setw(Min(nRegLevel, sal_uInt16(8))) << ' ' << "this = " << this
<< " Level = " << nRegLevel << " SfxBindings::EnterRegistrations "
@@ -1844,7 +1844,7 @@ void SfxBindings::LeaveRegistrations( sal_uInt16 nLevel, const char *pFile, int
}
}
- SAL_INFO_S(
+ SAL_INFO(
"sfx2",
std::setw(Min(nRegLevel, sal_uInt16(8))) << ' ' << "this = " << this
<< " Level = " << nRegLevel << " SfxBindings::LeaveRegistrations "
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index c26229146af0..ee7916dd1f04 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -476,7 +476,7 @@ void SfxDispatcher::Pop
SfxApplication *pSfxApp = SFX_APP();
- SAL_INFO_S(
+ SAL_INFO(
"sfx2",
"-SfxDispatcher(" << this << (bPush ? ")::Push(" : ")::Pop(")
<< (rShell.GetInterface()
@@ -1803,7 +1803,7 @@ void SfxDispatcher::FlushImpl()
for (sal_uInt16 n=0; n<SFX_OBJECTBAR_MAX; n++)
pImp->aFixedObjBars[n].nResId = 0;
- SAL_INFO_S("sfx2", "SfxDispatcher(" << this << ")::Flush() done");
+ SAL_INFO("sfx2", "SfxDispatcher(" << this << ")::Flush() done");
}
//--------------------------------------------------------------------
diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx
index 33a6f47e0c18..22a23be267d1 100644
--- a/sfx2/source/control/shell.cxx
+++ b/sfx2/source/control/shell.cxx
@@ -32,7 +32,7 @@
#include <com/sun/star/embed/VerbAttributes.hpp>
#include <basic/sbstar.hxx>
#include <rtl/oustringostreaminserter.hxx>
-#include <sal/log.h>
+#include <sal/log.hxx>
#include <svl/itempool.hxx>
#include <svl/undo.hxx>
#include <svtools/itemdel.hxx>
@@ -625,7 +625,7 @@ void SfxShell::DoActivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI )
if ( !p_IF )
return;
#endif
- SAL_INFO_S(
+ SAL_INFO(
"sfx2.vb",
"SfxShell::DoActivate() " << this << " " << GetInterface()->GetName()
<< " bMDI " << (bMDI ? "MDI" : ""));
@@ -661,7 +661,7 @@ void SfxShell::DoDeactivate_Impl( SfxViewFrame *pFrame, sal_Bool bMDI )
if ( !p_IF )
return;
#endif
- SAL_INFO_S(
+ SAL_INFO(
"sfx2.vb",
"SfxShell::DoDeactivate()" << this << " " << GetInterface()->GetName()
<< " bMDI " << (bMDI ? "MDI" : ""));
diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx
index ce5bb32b7db4..b9dac71f139d 100644
--- a/svl/source/items/poolio.cxx
+++ b/svl/source/items/poolio.cxx
@@ -32,7 +32,7 @@
#include <string.h>
#include <stdio.h>
-#include <sal/log.h>
+#include <sal/log.hxx>
#include <tools/solar.h>
#include <svl/itempool.hxx>
#include "whassert.hxx"
@@ -956,11 +956,11 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream)
delete rpNewItem;
rpNewItem = pOldItem;
bFound = true;
- SAL_INFO_S("svl", "reusing item" << pOldItem);
+ SAL_INFO("svl", "reusing item" << pOldItem);
break;
}
}
- SAL_INFO_IF_S(
+ SAL_INFO_IF(
!bFound, "svl", "item not found: " << pOldItem);
}
}
diff --git a/svl/source/items/whassert.hxx b/svl/source/items/whassert.hxx
index d994f0d33f66..290b2f06bca8 100644
--- a/svl/source/items/whassert.hxx
+++ b/svl/source/items/whassert.hxx
@@ -30,9 +30,9 @@
#include "sal/config.h"
-#include "sal/log.h"
+#include "sal/log.hxx"
-#define SFX_ASSERT( bCondition, nId, sMessage ) SAL_WARN_IF_S( \
+#define SFX_ASSERT( bCondition, nId, sMessage ) SAL_WARN_IF( \
!(bCondition), "svl", (sMessage) << ", with ID/pos " << (nId));
#endif
diff --git a/sw/source/ui/docvw/srcedtw.cxx b/sw/source/ui/docvw/srcedtw.cxx
index 04adab9ac1d4..9b468a827748 100644
--- a/sw/source/ui/docvw/srcedtw.cxx
+++ b/sw/source/ui/docvw/srcedtw.cxx
@@ -35,7 +35,7 @@
#include <rtl/oustringostreaminserter.hxx>
#include <rtl/ustring.hxx>
-#include <sal/log.h>
+#include <sal/log.hxx>
#include <svtools/textview.hxx>
#include <svx/svxids.hrc>
#include <vcl/scrbar.hxx>
@@ -163,7 +163,7 @@ static void lcl_Highlight(const String& rSource, SwTextPortions& aPortionList)
else
{
// what was that?
- SAL_WARN_S(
+ SAL_WARN(
"sw.level2",
"Token " << rtl::OUString(sToken)
<< " not recognised!");
diff --git a/tools/inc/tools/debug.hxx b/tools/inc/tools/debug.hxx
index 95b320979913..ecbfa3b07e8d 100644
--- a/tools/inc/tools/debug.hxx
+++ b/tools/inc/tools/debug.hxx
@@ -31,7 +31,7 @@
#include "tools/toolsdllapi.h"
-#include <sal/log.h>
+#include <sal/detail/log.h>
#include <sal/types.h>
#include <tools/solar.h>
@@ -40,7 +40,7 @@
if an assertion fails, and is controlled by the standard NDEBUG macro).
Logging of warnings (e.g., about malformed input) and traces (e.g., about
steps taken while executing some protocol) should use the facilities
- provided by sal/log.h.
+ provided by sal/log.hxx.
Because the assertion macros (DBG_ASSERTWARNING, DBG_ASSERT, DBG_BF_ASSERT)
have been used for true assertions as well as for logged warnings, they map
@@ -467,33 +467,36 @@ public:
(const void*)pObj, (DbgUsr)fTest )
#define DBG_ASSERTWARNING( sCon, aWarning ) \
- SAL_WARN_IF(!(sCon), "legacy.tools", aWarning)
+ SAL_DETAIL_WARN_IF_FORMAT(!(sCon), "legacy.tools", aWarning)
#define DBG_ASSERT( sCon, aError ) \
- SAL_WARN_IF(!(sCon), "legacy.tools", aError)
+ SAL_DETAIL_WARN_IF_FORMAT(!(sCon), "legacy.tools", aError)
#ifdef DBG_BINFILTER
#define DBG_BF_ASSERT( sCon, aError ) \
- SAL_WARN_IF(!(sCon), "legacy.binfilter", aError)
+ SAL_DETAIL_WARN_IF_FORMAT(!(sCon), "legacy.binfilter", aError)
#else
#define DBG_BF_ASSERT( sCon, aError ) ((void)0)
#endif
-#define DBG_WARNING( aWarning ) SAL_WARN("legacy.tools", aWarning)
-#define DBG_WARNING1( aWarning, x1 ) SAL_WARN("legacy.tools", aWarning, x1)
+#define DBG_WARNING( aWarning ) \
+ SAL_DETAIL_WARN_IF_FORMAT(true, "legacy.tools", aWarning)
+#define DBG_WARNING1( aWarning, x1 ) \
+ SAL_DETAIL_WARN_IF_FORMAT(true, "legacy.tools", aWarning, x1)
#define DBG_WARNING2( aWarning, x1, x2 ) \
- SAL_WARN("legacy.tools", aWarning, x1, x2)
+ SAL_DETAIL_WARN_IF_FORMAT(true, "legacy.tools", aWarning, x1, x2)
#define DBG_WARNING3( aWarning, x1, x2, x3 ) \
- SAL_WARN("legacy.tools", aWarning, x1, x2, x3)
+ SAL_DETAIL_WARN_IF_FORMAT(true, "legacy.tools", aWarning, x1, x2, x3)
#define DBG_WARNING4( aWarning, x1, x2, x3, x4 ) \
- SAL_WARN("legacy.tools", aWarning, x1, x2, x3, x4)
+ SAL_DETAIL_WARN_IF_FORMAT(true, "legacy.tools", aWarning, x1, x2, x3, x4)
#define DBG_WARNING5( aWarning, x1, x2, x3, x4, x5 ) \
- SAL_WARN("legacy.tools", aWarning, x1, x2, x3, x4, x5)
-#define DBG_WARNINGFILE( aWarning ) \
- SAL_WARN("legacy.tools", aWarning, __FILE__, __LINE__)
+ SAL_DETAIL_WARN_IF_FORMAT( \
+ true, "legacy.tools", aWarning, x1, x2, x3, x4, x5)
+#define DBG_WARNINGFILE( aWarning ) SAL_DETAIL_WARN_IF_FORMAT( \
+ true, "legacy.tools", aWarning, __FILE__, __LINE__)
#define DBG_ERRORFILE( aError ) \
- SAL_WARN("legacy.tools", aError, __FILE__, __LINE__)
+ SAL_DETAIL_WARN_IF_FORMAT(true, "legacy.tools", aError, __FILE__, __LINE__)
#define DBG_TESTSOLARMUTEX() \
do \
diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx
index d3f2c088b897..091f459b2319 100644
--- a/tools/source/debug/debug.cxx
+++ b/tools/source/debug/debug.cxx
@@ -50,7 +50,7 @@
#include <tools/debug.hxx>
#include <rtl/string.h>
-#include <sal/log.h>
+#include <sal/log.hxx>
#include <sal/macros.h>
#include <vector>
@@ -1334,7 +1334,7 @@ void DbgProf( sal_uInt16 nAction, DbgDataType* pDbgData )
sal_uIntPtr nTime;
if ( (nAction != DBG_PROF_START) && !pProfData )
{
- SAL_WARN_S(
+ SAL_WARN(
"tools.debug",
"DBG_PROF...() without DBG_PROFSTART(): " << pDbgData->pName);
return;
@@ -1454,7 +1454,7 @@ void DbgXtor( DbgDataType* pDbgData, sal_uInt16 nAction, const void* pThis,
sal_uInt16 nAct = nAction & ~DBG_XTOR_DTOROBJ;
- SAL_INFO_IF_S(
+ SAL_INFO_IF(
((pData->aDbgData.nTestFlags & DBG_TEST_XTOR_TRACE)
&& !(nAction & DBG_XTOR_DTOROBJ) && nAct != DBG_XTOR_CHKOBJ),
"tools.debug",
@@ -1468,7 +1468,7 @@ void DbgXtor( DbgDataType* pDbgData, sal_uInt16 nAction, const void* pThis,
// DBG_CTOR-Aufruf vor allen anderen DBG_XTOR-Aufrufen
if ( ((nAction & ~DBG_XTOR_DTOROBJ) != DBG_XTOR_CTOR) && !pDbgData->pData )
{
- SAL_WARN_S(
+ SAL_WARN(
"tools.debug",
"DBG_DTOR() or DBG_CHKTHIS() without DBG_CTOR(): "
<< pDbgData->pName);
@@ -1484,7 +1484,7 @@ void DbgXtor( DbgDataType* pDbgData, sal_uInt16 nAction, const void* pThis,
// This-Pointer == NULL
if ( !pThis )
{
- SAL_WARN_S(
+ SAL_WARN(
"tools.debug",
"this == NULL in class " << pDbgData->pName);
return;
@@ -1492,7 +1492,7 @@ void DbgXtor( DbgDataType* pDbgData, sal_uInt16 nAction, const void* pThis,
if ( (nAction & ~DBG_XTOR_DTOROBJ) != DBG_XTOR_CTOR )
{
- SAL_WARN_IF_S(
+ SAL_WARN_IF(
!pXtorData->aThisList.IsIn(pThis), "tools.debug",
"invalid this-Pointer %p in class " << pDbgData->pName);
}
@@ -1558,13 +1558,13 @@ void DbgXtor( DbgDataType* pDbgData, sal_uInt16 nAction, const void* pThis,
}
// Gegebenenfalls Fehlermeldung ausgeben
- SAL_WARN_IF_S(
+ SAL_WARN_IF(
pMsg, "tools.debug",
"Error-Msg from Object " << pThis << " in class "
<< pDbgData->pName << ": " << pMsg);
}
- SAL_INFO_IF_S(
+ SAL_INFO_IF(
((pData->aDbgData.nTestFlags & DBG_TEST_XTOR_TRACE)
&& (nAction & DBG_XTOR_DTOROBJ) && nAct != DBG_XTOR_CHKOBJ),
"tools.debug",
diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx
index 2ea66b2dce7d..93b8ea133aaf 100644
--- a/tools/source/rc/resmgr.cxx
+++ b/tools/source/rc/resmgr.cxx
@@ -46,7 +46,7 @@
#include <rtl/oustringostreaminserter.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/strbuf.hxx>
-#include <sal/log.h>
+#include <sal/log.hxx>
#include <tools/urlobj.hxx>
#include <rtl/instance.hxx>
#include <rtl/bootstrap.hxx>
@@ -949,7 +949,7 @@ void ResMgr::Init( const OUString& rFileName )
InternalResMgr::FreeGlobalRes( aResHandle, pVoid );
else
{
- SAL_WARN_S("tools", "Wrong version: " << pImpRes->aFileName);
+ SAL_WARN("tools", "Wrong version: " << pImpRes->aFileName);
}
}
#endif
diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx
index 126c56cadd77..cb6aa53c5a39 100755
--- a/vcl/source/app/dbggui.cxx
+++ b/vcl/source/app/dbggui.cxx
@@ -39,7 +39,7 @@
#include <limits.h>
#include "tools/debug.hxx"
-#include "sal/log.h"
+#include "sal/log.hxx"
#include "vcl/svapp.hxx"
#include "vcl/event.hxx"