LibreOffice Module sal (master) 1
Macros
log.hxx File Reference
#include "sal/config.h"
#include <cstdlib>
#include <sstream>
#include <string>
#include "sal/detail/log.h"
#include "sal/saldllapi.h"
#include "sal/types.h"
Include dependency graph for log.hxx:

Go to the source code of this file.

Macros

#define SAL_WHERE   SAL_DETAIL_WHERE
 A simple macro to create a "file and line number" string. More...
 
#define SAL_STREAM(stream)    (dynamic_cast< ::std::ostringstream & >(::std::ostringstream() << stream).str())
 A facility for generating temporary string messages by piping items into a C++ std::ostringstream. More...
 
#define SAL_INFO(area, stream)
 Produce log entry from stream in the given log area. More...
 
#define SAL_INFO_IF(condition, area, stream)
 Produce log entry from stream in the given log area if condition is true. More...
 
#define SAL_WARN(area, stream)
 Produce warning entry from stream in the given log area. More...
 
#define SAL_WARN_IF(condition, area, stream)
 Produce warning entry from stream in the given log area if condition is true. More...
 
#define SAL_DEBUG(stream)
 Produce temporary debugging output from stream. More...
 
#define SAL_DEBUG_IF(condition, stream)
 Produce temporary debugging output from stream, if condition is true. More...
 
#define SAL_DEBUG_BACKTRACE(stream, backtraceDepth)
 Produce temporary debugging output from stream along with a backtrace of the calling location. More...
 

Macro Definition Documentation

◆ SAL_DEBUG

#define SAL_DEBUG (   stream)
Value:
SAL_DETAIL_LOG_STREAM( \
SAL_LOG_TRUE, ::SAL_DETAIL_LOG_LEVEL_DEBUG, NULL, NULL, 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.

See basic logging functionality for details.

Definition at line 384 of file log.hxx.

◆ SAL_DEBUG_BACKTRACE

#define SAL_DEBUG_BACKTRACE (   stream,
  backtraceDepth 
)
Value:
do { \
if (sizeof ::sal::detail::getResult( \
::sal::detail::StreamStart() << stream) == 1) \
{ \
::sal_detail_log( \
::SAL_DETAIL_LOG_LEVEL_DEBUG, NULL, NULL, \
::sal::detail::unwrapStream( \
::sal::detail::StreamStart() << stream), \
backtraceDepth); \
} else { \
::std::ostringstream sal_detail_stream; \
sal_detail_stream << stream; \
::sal::detail::log( \
::SAL_DETAIL_LOG_LEVEL_DEBUG, NULL, NULL, sal_detail_stream, \
backtraceDepth); \
} \
} while (false)
Reference< XOutputStream > stream

Produce temporary debugging output from stream along with a backtrace of the calling location.

This macro is meant to be used only while working on code and should never exist in production code.

Parameters
streaminput stream
backtraceDeptha sal_uInt32 value indicating the maximum backtrace depth; zero means no backtrace

See basic logging functionality for details.

Definition at line 413 of file log.hxx.

◆ SAL_DEBUG_IF

#define SAL_DEBUG_IF (   condition,
  stream 
)
Value:
SAL_DETAIL_LOG_STREAM( \
(condition), ::SAL_DETAIL_LOG_LEVEL_DEBUG, NULL, NULL, stream)

Produce temporary debugging output from stream, if condition is true.

This macro is meant to be used only while working on code and should never exist in production code.

See basic logging functionality for details.

Definition at line 395 of file log.hxx.

◆ SAL_INFO

#define SAL_INFO (   area,
  stream 
)
Value:
SAL_DETAIL_LOG_STREAM( \
SAL_DETAIL_ENABLE_LOG_INFO, ::SAL_DETAIL_LOG_LEVEL_INFO, area, \
SAL_WHERE, stream)
#define SAL_WHERE
A simple macro to create a "file and line number" string.
Definition: log.hxx:179

Produce log entry from stream in the given log area.

See basic logging functionality for details.

Definition at line 343 of file log.hxx.

◆ SAL_INFO_IF

#define SAL_INFO_IF (   condition,
  area,
  stream 
)
Value:
SAL_DETAIL_LOG_STREAM( \
SAL_DETAIL_ENABLE_LOG_INFO && (condition), \
::SAL_DETAIL_LOG_LEVEL_INFO, area, SAL_WHERE, stream)

Produce log entry from stream in the given log area if condition is true.

See basic logging functionality for details.

Definition at line 353 of file log.hxx.

◆ SAL_STREAM

#define SAL_STREAM (   stream)     (dynamic_cast< ::std::ostringstream & >(::std::ostringstream() << stream).str())

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 when depending on some boolean condition data of incompatible types shall be streamed into the message, as in:

SAL_INFO("foo", "object: " << (hasName ? obj->name : SAL_STREAM(obj)));

Attention: \n For now, this functionality should only be used internally within
LibreOffice. It may change again in a future version.
Available since: \n LibreOffice 3.5

Definition at line 202 of file log.hxx.

◆ SAL_WARN

#define SAL_WARN (   area,
  stream 
)
Value:
SAL_DETAIL_LOG_STREAM( \
SAL_DETAIL_ENABLE_LOG_WARN, ::SAL_DETAIL_LOG_LEVEL_WARN, area, \
SAL_WHERE, stream)

Produce warning entry from stream in the given log area.

See basic logging functionality for details.

Definition at line 363 of file log.hxx.

◆ SAL_WARN_IF

#define SAL_WARN_IF (   condition,
  area,
  stream 
)
Value:
SAL_DETAIL_LOG_STREAM( \
SAL_DETAIL_ENABLE_LOG_WARN && (condition), \
::SAL_DETAIL_LOG_LEVEL_WARN, area, SAL_WHERE, stream)

Produce warning entry from stream in the given log area if condition is true.

See basic logging functionality for details.

Definition at line 373 of file log.hxx.

◆ SAL_WHERE

#define SAL_WHERE   SAL_DETAIL_WHERE

A simple macro to create a "file and line number" string.

Potentially not only useful within the log framework (where it is used automatically), but also when creating exception messages.

Attention: \n For now, this functionality should only be used internally within
LibreOffice. It may change again in a future version.
Available since: \n LibreOffice 3.5

Definition at line 179 of file log.hxx.