[Libreoffice] Assertions and Logging
Miklos Vajna
vmiklos at frugalware.org
Tue Nov 22 14:50:29 PST 2011
On Fri, Nov 18, 2011 at 03:25:16PM +0100, Stephan Bergmann <sbergman at redhat.com> wrote:
> #define OSL_DEBUG_ONLY(s) _OSL_DEBUG_ONLY(s)
> -#define OSL_TRACE _OSL_TRACE
> -#define OSL_ASSERT(c) _OSL_ENSURE(c, OSL_THIS_FILE, __LINE__, 0)
> -#define OSL_ENSURE(c, m) _OSL_ENSURE(c, OSL_THIS_FILE, __LINE__, m)
> -#define OSL_FAIL(m) _OSL_ENSURE(0, OSL_THIS_FILE, __LINE__, m)
> +#define OSL_TRACE(...) SAL_INFO("legacy.osl", __VA_ARGS__)
> +#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)
Hi Stephan,
These changes cause that without an
export SAL_LOG="+INFO"
former OSL_TRACE() messages do not show up on the console, even with
dbglevel=2.
I like that SAL_LOG can now filter SAL_INFO messages, but are you sure
it's a good idea to disable them all by default with dbglevel=2, instead
of enabling them by default (when SAL_LOG is not set), like it was
before?
IOW, is the attached patch OK?
Thanks.
-------------- next part --------------
diff --git a/sal/osl/all/log.cxx b/sal/osl/all/log.cxx
index be45cf6..9493715 100644
--- a/sal/osl/all/log.cxx
+++ b/sal/osl/all/log.cxx
@@ -84,7 +84,11 @@ bool report(sal_detail_LogLevel level, char const * area) {
assert(area != 0);
char const * env = std::getenv("SAL_LOG");
if (env == 0) {
+#if OSL_DEBUG_LEVEL > 1
+ env = "+INFO+WARN";
+#else
env = "+WARN";
+#endif
}
std::size_t areaLen = std::strlen(area);
enum Sense { POSITIVE = 0, NEGATIVE = 1 };
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20111122/eb4c2286/attachment.pgp>
More information about the LibreOffice
mailing list