| OpenCV 5.0.0alpha Open Source Computer Vision

Loading...
Searching...
No Matches
Namespaces | Classes | Macros | Functions
Logging facilities
Core functionality » Utility and system functions and macros

## Detailed Description

## Namespaces
namespace | cv
namespace | cv::utils::logging::internal

## Classes
struct | cv::utils::logging::LogTagAuto

## Macros
#define | CV_LOG_DEBUG(tag, ...)
#define | CV_LOG_ERROR(tag, ...)
#define | CV_LOG_FATAL(tag, ...)
#define | CV_LOG_IF_DEBUG(tag, logging_cond, ...)
#define | CV_LOG_IF_ERROR(tag, logging_cond, ...)
#define | CV_LOG_IF_FATAL(tag, logging_cond, ...)
#define | CV_LOG_IF_INFO(tag, logging_cond, ...)
#define | CV_LOG_IF_VERBOSE(tag, v, logging_cond, ...)
#define | CV_LOG_IF_WARNING(tag, logging_cond, ...)
#define | CV_LOG_INFO(tag, ...)
#define | CV_LOG_LEVEL_DEBUG 5
| Debug message. Disabled in the "Release" build.
#define | CV_LOG_LEVEL_ERROR 2
| Error message.
#define | CV_LOG_LEVEL_FATAL 1
| Fatal (critical) error (unrecoverable internal error)
#define | CV_LOG_LEVEL_INFO 4
| Info message.
#define | CV_LOG_LEVEL_SILENT 0
| for using in setLogLevel() call
#define | CV_LOG_LEVEL_VERBOSE 6
| Verbose (trace) messages. Requires verbosity level. Disabled in the "Release" build.
#define | CV_LOG_LEVEL_WARN 3
| Warning message.
#define | CV_LOG_ONCE_DEBUG(tag, ...)
#define | CV_LOG_ONCE_ERROR(tag, ...)
#define | CV_LOG_ONCE_INFO(tag, ...)
#define | CV_LOG_ONCE_VERBOSE(tag, v, ...)
#define | CV_LOG_ONCE_WARNING(tag, ...)
#define | CV_LOG_STRIP_LEVEL CV_LOG_LEVEL_VERBOSE
#define | CV_LOG_VERBOSE(tag, v, ...)
#define | CV_LOG_WARNING(tag, ...)
#define | CV_LOG_WITH_TAG(tag, msgLevel, extra_check0, extra_check1, ...)
#define | CV_LOGTAG_EXPAND_NAME(tag)
#define | CV_LOGTAG_FALLBACK nullptr
#define | CV_LOGTAG_GLOBAL cv::utils::logging::internal::getGlobalLogTag()
#define | CV_LOGTAG_PTR_CAST(expr)
#define | CV_TRACE_ARG(arg_id)
| Macro to trace argument value.
#define | CV_TRACE_ARG_VALUE(arg_id, arg_name, value)
| Macro to trace argument value (expanded version)
#define | CV_TRACE_FUNCTION()
| Macro to trace function.
#define | CV_TRACE_FUNCTION_SKIP_NESTED()
#define | CV_TRACE_REGION(name_as_static_string_literal)
#define | CV_TRACE_REGION_NEXT(name_as_static_string_literal)

## Functions
LogLevel | cv::utils::logging::getLogLevel ()
cv::utils::logging::LogLevel | cv::utils::logging::getLogTagLevel (const char *tag)
void | cv::utils::logging::registerLogTag (cv::utils::logging::LogTag *plogtag)
LogLevel | cv::utils::logging::setLogLevel (LogLevel logLevel)
void | cv::utils::logging::setLogTagLevel (const char *tag, cv::utils::logging::LogLevel level)

## Macro Definition Documentation

## ◆ CV_LOG_DEBUG

#define CV_LOG_DEBUG | ( |  | tag,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

Value:
CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_DEBUG, , , __VA_ARGS__)
CV_LOG_WITH_TAG
#define CV_LOG_WITH_TAG(tag, msgLevel, extra_check0, extra_check1,...)
Definition logger.hpp:107
cv::utils::logging::LOG_LEVEL_DEBUG
@ LOG_LEVEL_DEBUG
Debug message. Disabled in the "Release" build.
Definition logger.defines.hpp:31

## ◆ CV_LOG_ERROR

#define CV_LOG_ERROR | ( |  | tag,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

Value:
CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_ERROR, , , __VA_ARGS__)
cv::utils::logging::LOG_LEVEL_ERROR
@ LOG_LEVEL_ERROR
Error message.
Definition logger.defines.hpp:28

## ◆ CV_LOG_FATAL

#define CV_LOG_FATAL | ( |  | tag,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

Value:
CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_FATAL, , , __VA_ARGS__)
cv::utils::logging::LOG_LEVEL_FATAL
@ LOG_LEVEL_FATAL
Fatal (critical) error (unrecoverable internal error)
Definition logger.defines.hpp:27

## ◆ CV_LOG_IF_DEBUG

#define CV_LOG_IF_DEBUG | ( |  | tag,
|  |  | logging_cond,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

Value:
CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_DEBUG, , CV__LOG_IF_CHECK(logging_cond), __VA_ARGS__)

## ◆ CV_LOG_IF_ERROR

#define CV_LOG_IF_ERROR | ( |  | tag,
|  |  | logging_cond,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

Value:
CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_ERROR, , CV__LOG_IF_CHECK(logging_cond), __VA_ARGS__)

## ◆ CV_LOG_IF_FATAL

#define CV_LOG_IF_FATAL | ( |  | tag,
|  |  | logging_cond,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

Value:
CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_FATAL, , CV__LOG_IF_CHECK(logging_cond), __VA_ARGS__)

## ◆ CV_LOG_IF_INFO

#define CV_LOG_IF_INFO | ( |  | tag,
|  |  | logging_cond,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

Value:
CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_INFO, , CV__LOG_IF_CHECK(logging_cond), __VA_ARGS__)
cv::utils::logging::LOG_LEVEL_INFO
@ LOG_LEVEL_INFO
Info message.
Definition logger.defines.hpp:30

## ◆ CV_LOG_IF_VERBOSE [1/2]

#define CV_LOG_IF_VERBOSE | ( |  | tag,
|  |  | v,
|  |  | logging_cond,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

Value:
CV_LOG_WITH_TAG(tag, (cv::utils::logging::LOG_LEVEL_VERBOSE + (int)(v)), , CV__LOG_IF_CHECK(logging_cond), __VA_ARGS__)
cv::utils::logging::LOG_LEVEL_VERBOSE
@ LOG_LEVEL_VERBOSE
Verbose (trace) messages. Requires verbosity level. Disabled in the "Release" build.
Definition logger.defines.hpp:32

## ◆ CV_LOG_IF_VERBOSE [2/2]

#define CV_LOG_IF_VERBOSE | ( |  | tag,
|  |  | v,
|  |  | logging_cond,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

## ◆ CV_LOG_IF_WARNING

#define CV_LOG_IF_WARNING | ( |  | tag,
|  |  | logging_cond,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

Value:
CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_WARNING, , CV__LOG_IF_CHECK(logging_cond), __VA_ARGS__)
cv::utils::logging::LOG_LEVEL_WARNING
@ LOG_LEVEL_WARNING
Warning message.
Definition logger.defines.hpp:29

## ◆ CV_LOG_INFO

#define CV_LOG_INFO | ( |  | tag,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

Value:
CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_INFO, , , __VA_ARGS__)

## ◆ CV_LOG_LEVEL_DEBUG

#define CV_LOG_LEVEL_DEBUG 5

`#include <opencv2/core/utils/logger.defines.hpp>`

Debug message. Disabled in the "Release" build.

## ◆ CV_LOG_LEVEL_ERROR

#define CV_LOG_LEVEL_ERROR 2

`#include <opencv2/core/utils/logger.defines.hpp>`

Error message.

## ◆ CV_LOG_LEVEL_FATAL

#define CV_LOG_LEVEL_FATAL 1

`#include <opencv2/core/utils/logger.defines.hpp>`

Fatal (critical) error (unrecoverable internal error)

## ◆ CV_LOG_LEVEL_INFO

#define CV_LOG_LEVEL_INFO 4

`#include <opencv2/core/utils/logger.defines.hpp>`

Info message.

## ◆ CV_LOG_LEVEL_SILENT

#define CV_LOG_LEVEL_SILENT 0

`#include <opencv2/core/utils/logger.defines.hpp>`

for using in setLogLevel() call

## ◆ CV_LOG_LEVEL_VERBOSE

#define CV_LOG_LEVEL_VERBOSE 6

`#include <opencv2/core/utils/logger.defines.hpp>`

Verbose (trace) messages. Requires verbosity level. Disabled in the "Release" build.

## ◆ CV_LOG_LEVEL_WARN

#define CV_LOG_LEVEL_WARN 3

`#include <opencv2/core/utils/logger.defines.hpp>`

Warning message.

## ◆ CV_LOG_ONCE_DEBUG

#define CV_LOG_ONCE_DEBUG | ( |  | tag,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

Value:
CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_DEBUG, CV__LOG_ONCE_CHECK_PRE, CV__LOG_ONCE_CHECK_POST, __VA_ARGS__)

## ◆ CV_LOG_ONCE_ERROR

#define CV_LOG_ONCE_ERROR | ( |  | tag,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

Value:
CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_ERROR, CV__LOG_ONCE_CHECK_PRE, CV__LOG_ONCE_CHECK_POST, __VA_ARGS__)

## ◆ CV_LOG_ONCE_INFO

#define CV_LOG_ONCE_INFO | ( |  | tag,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

Value:
CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_INFO, CV__LOG_ONCE_CHECK_PRE, CV__LOG_ONCE_CHECK_POST, __VA_ARGS__)

## ◆ CV_LOG_ONCE_VERBOSE [1/2]

#define CV_LOG_ONCE_VERBOSE | ( |  | tag,
|  |  | v,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

Value:
CV_LOG_WITH_TAG(tag, (cv::utils::logging::LOG_LEVEL_VERBOSE + (int)(v)), CV__LOG_ONCE_CHECK_PRE, CV__LOG_ONCE_CHECK_POST, __VA_ARGS__)

## ◆ CV_LOG_ONCE_VERBOSE [2/2]

#define CV_LOG_ONCE_VERBOSE | ( |  | tag,
|  |  | v,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

## ◆ CV_LOG_ONCE_WARNING

#define CV_LOG_ONCE_WARNING | ( |  | tag,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

Value:
CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_WARNING, CV__LOG_ONCE_CHECK_PRE, CV__LOG_ONCE_CHECK_POST, __VA_ARGS__)

## ◆ CV_LOG_STRIP_LEVEL

#define CV_LOG_STRIP_LEVEL CV_LOG_LEVEL_VERBOSE

`#include <opencv2/core/utils/logger.hpp>`

Define CV_LOG_STRIP_LEVEL=CV_LOG_LEVEL_[DEBUG|INFO|WARN|ERROR|FATAL|SILENT] to compile out anything at that and before that logging level

## ◆ CV_LOG_VERBOSE [1/2]

#define CV_LOG_VERBOSE | ( |  | tag,
|  |  | v,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

Value:
CV_LOG_WITH_TAG(tag, (cv::utils::logging::LOG_LEVEL_VERBOSE + (int)(v)), , , __VA_ARGS__)

## ◆ CV_LOG_VERBOSE [2/2]

#define CV_LOG_VERBOSE | ( |  | tag,
|  |  | v,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

## ◆ CV_LOG_WARNING

#define CV_LOG_WARNING | ( |  | tag,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

Value:
CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_WARNING, , , __VA_ARGS__)

## ◆ CV_LOG_WITH_TAG

#define CV_LOG_WITH_TAG | ( |  | tag,
|  |  | msgLevel,
|  |  | extra_check0,
|  |  | extra_check1,
|  |  | ... )

`#include <opencv2/core/utils/logger.hpp>`

Value:
for(;;) { \
extra_check0; \
const auto cv_temp_msglevel = (cv::utils::logging::LogLevel)(msgLevel); \
if (cv_temp_msglevel >= (CV_LOG_STRIP_LEVEL)) break; \
auto cv_temp_logtagptr = CV_LOGTAG_PTR_CAST(CV_LOGTAG_EXPAND_NAME(tag)); \
if (!cv_temp_logtagptr) cv_temp_logtagptr = CV_LOGTAG_PTR_CAST(CV_LOGTAG_FALLBACK); \
if (!cv_temp_logtagptr) cv_temp_logtagptr = CV_LOGTAG_PTR_CAST(CV_LOGTAG_GLOBAL); \
if (cv_temp_logtagptr && (cv_temp_msglevel > cv_temp_logtagptr->level)) break; \
extra_check1; \
std::stringstream cv_temp_logstream; \
cv_temp_logstream << __VA_ARGS__; \
cv::utils::logging::internal::writeLogMessageEx( \
cv_temp_msglevel, \
(cv_temp_logtagptr ? cv_temp_logtagptr->name : nullptr), \
__FILE__, \
__LINE__, \
CV_Func, \
cv_temp_logstream.str().c_str()); \
break; \
}
CV_LOGTAG_PTR_CAST
#define CV_LOGTAG_PTR_CAST(expr)
Definition logger.hpp:71
CV_LOGTAG_EXPAND_NAME
#define CV_LOGTAG_EXPAND_NAME(tag)
Definition logger.hpp:93
CV_LOGTAG_GLOBAL
#define CV_LOGTAG_GLOBAL
Definition logger.hpp:105
CV_LOG_STRIP_LEVEL
#define CV_LOG_STRIP_LEVEL
Definition logger.hpp:67
CV_LOGTAG_FALLBACK
#define CV_LOGTAG_FALLBACK
Definition logger.hpp:99
cv::utils::logging::LogLevel
LogLevel
Supported logging levels and their semantic.
Definition logger.defines.hpp:25
cv
Definition core.hpp:107
std
STL namespace.

## ◆ CV_LOGTAG_EXPAND_NAME

#define CV_LOGTAG_EXPAND_NAME | ( |  | tag | ) |

`#include <opencv2/core/utils/logger.hpp>`

Value:
tag

## ◆ CV_LOGTAG_FALLBACK

#define CV_LOGTAG_FALLBACK nullptr

`#include <opencv2/core/utils/logger.hpp>`

## ◆ CV_LOGTAG_GLOBAL

#define CV_LOGTAG_GLOBAL cv::utils::logging::internal::getGlobalLogTag()

`#include <opencv2/core/utils/logger.hpp>`

## ◆ CV_LOGTAG_PTR_CAST

#define CV_LOGTAG_PTR_CAST | ( |  | expr | ) |

`#include <opencv2/core/utils/logger.hpp>`

Value:
static_cast<const cv::utils::logging::LogTag*>(expr)
cv::utils::logging::LogTag
Definition logtag.hpp:16

## ◆ CV_TRACE_ARG

#define CV_TRACE_ARG | ( |  | arg_id | ) |

`#include <opencv2/core/utils/trace.hpp>`

Macro to trace argument value.

## ◆ CV_TRACE_ARG_VALUE

#define CV_TRACE_ARG_VALUE | ( |  | arg_id,
|  |  | arg_name,
|  |  | value )

`#include <opencv2/core/utils/trace.hpp>`

Macro to trace argument value (expanded version)

## ◆ CV_TRACE_FUNCTION

#define CV_TRACE_FUNCTION | ( |  | ) |

`#include <opencv2/core/utils/trace.hpp>`

Macro to trace function.

## ◆ CV_TRACE_FUNCTION_SKIP_NESTED

#define CV_TRACE_FUNCTION_SKIP_NESTED | ( |  | ) |

`#include <opencv2/core/utils/trace.hpp>`

## ◆ CV_TRACE_REGION

#define CV_TRACE_REGION | ( |  | name_as_static_string_literal | ) |

`#include <opencv2/core/utils/trace.hpp>`

Trace code scope.

Note
  Dynamic names are not supported in this macro (on stack or heap). Use string literals here only, like "initialize".

## ◆ CV_TRACE_REGION_NEXT

#define CV_TRACE_REGION_NEXT | ( |  | name_as_static_string_literal | ) |

`#include <opencv2/core/utils/trace.hpp>`

mark completed of the current opened region and create new one

Note
  Dynamic names are not supported in this macro (on stack or heap). Use string literals here only, like "step1".

## Function Documentation

## ◆ getLogLevel()

LogLevel cv::utils::logging::getLogLevel | ( |  | ) |

`#include <opencv2/core/utils/logger.hpp>`

Get global logging level

## ◆ getLogTagLevel()

cv::utils::logging::LogLevel cv::utils::logging::getLogTagLevel | ( | const char * | tag | ) |

`#include <opencv2/core/utils/logger.hpp>`

## ◆ registerLogTag()

void cv::utils::logging::registerLogTag | ( | cv::utils::logging::LogTag * | plogtag | ) |

`#include <opencv2/core/utils/logger.hpp>`

## ◆ setLogLevel()

LogLevel cv::utils::logging::setLogLevel | ( | LogLevel | logLevel | ) |

`#include <opencv2/core/utils/logger.hpp>`

Set global logging level

Returns
  previous logging level

## ◆ setLogTagLevel()

void cv::utils::logging::setLogTagLevel | ( | const char * | tag,
|  | cv::utils::logging::LogLevel | level )

`#include <opencv2/core/utils/logger.hpp>`