LibreOffice: osl/diagnose.h File Reference

LibreOffice LibreOffice 25.2 SDK C/C++ API Reference

Loading...
Searching...
No Matches
diagnose.h File Reference

Provides simple diagnostic support. More...

`#include "sal/config.h"`
`#include "sal/detail/log.h"`
`#include "sal/types.h"`

Go to the source code of this file.

## Macros
#define | OSL_DEBUG_LEVEL 0
#define | OSL_LOG_PREFIX SAL_DETAIL_WHERE
#define | OSL_TRACE(...)
| Prints trace message.
#define | OSL_ASSERT(c)
| If cond is false, reports an error.
#define | OSL_ENSURE(c, m)
| If cond is false, reports an error with message msg.
#define | OSL_FAIL(m)
| Reports an error with message msg unconditionally.
#define | OSL_VERIFY(c)
| Evaluates the expression and if it is false, reports an error.
#define | OSL_PRECOND(c, m)
| Check the precondition of functions.
#define | OSL_POSTCOND(c, m)
| Check the postcondition of functions.

## Detailed Description

Provides simple diagnostic support.

Deprecated
  The facilities provided by this header are deprecated. True assertions (that detect broken program logic) should use standard assert (which aborts 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 (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 warnings, they map to SAL_WARN instead of standard assert. OSL_TRACE maps to SAL_INFO.

The functions defined in this header are not intended to be used directly, but through defined macros. The macros can be divided into three categories: assertions, traces and other stuff .-) Their usability depends on the value of OSL_DEBUG_LEVEL macro: assertions are only active if OSL_DEBUG_LEVEL is 1 or greater, traces if OSL_DEBUG_LEVEL is 2 or greater.

Traces: OSL_TRACE(fmt, args...) Prints trace message. The arguments have the same meaning as the arguments of printf.

## Macro Definition Documentation

## ◆ OSL_DEBUG_LEVEL

#define OSL_DEBUG_LEVEL 0

## ◆ OSL_LOG_PREFIX

#define OSL_LOG_PREFIX SAL_DETAIL_WHERE

## ◆ OSL_TRACE

#define OSL_TRACE | ( |  | ... | ) |

Value:
SAL_DETAIL_INFO_IF_FORMAT(OSL_DEBUG_LEVEL > 0, "legacy.osl", __VA_ARGS__)
OSL_DEBUG_LEVEL
#define OSL_DEBUG_LEVEL
Definition diagnose.h:61

Prints trace message.

The arguments have the same meaning as the arguments of printf.