OpenCV  4.1.1
Open Source Computer Vision
Classes | Namespaces | Macros | Functions
logger.hpp File Reference
#include <iostream>
#include <sstream>
#include <limits.h>
#include "logger.defines.hpp"
#include "logtag.hpp"

Classes

struct  cv::utils::logging::LogTagAuto
 

Namespaces

 cv
 "black box" representation of the file storage associated with a file on disk.
 
 cv::utils
 
 cv::utils::logging
 
 cv::utils::logging::internal
 

Macros

#define CV_LOG_DEBUG(tag, ...)   CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_DEBUG, __VA_ARGS__)
 
#define CV_LOG_ERROR(tag, ...)   CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_ERROR, __VA_ARGS__)
 
#define CV_LOG_FATAL(tag, ...)   CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_FATAL, __VA_ARGS__)
 
#define CV_LOG_INFO(tag, ...)   CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_INFO, __VA_ARGS__)
 
#define CV_LOG_STRIP_LEVEL   CV_LOG_LEVEL_VERBOSE
 
#define CV_LOG_VERBOSE(tag, v, ...)   CV_LOG_WITH_TAG(tag, (cv::utils::logging::LOG_LEVEL_VERBOSE + (int)(v)), __VA_ARGS__)
 
#define CV_LOG_VERBOSE(tag, v, ...)
 
#define CV_LOG_WARNING(tag, ...)   CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_WARNING, __VA_ARGS__)
 
#define CV_LOG_WITH_TAG(tag, msgLevel, ...)
 
#define CV_LOGTAG_EXPAND_NAME(tag)   tag
 
#define CV_LOGTAG_FALLBACK   nullptr
 
#define CV_LOGTAG_GLOBAL   cv::utils::logging::internal::getGlobalLogTag()
 
#define CV_LOGTAG_PTR_CAST(expr)   static_cast<const cv::utils::logging::LogTag*>(expr)
 

Functions

cv::utils::logging::LogTagcv::utils::logging::internal::getGlobalLogTag ()
 
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)
 
void cv::utils::logging::internal::writeLogMessage (LogLevel logLevel, const char *message)
 
void cv::utils::logging::internal::writeLogMessageEx (LogLevel logLevel, const char *tag, const char *file, int line, const char *func, const char *message)
 

Macro Definition Documentation

§ CV_LOG_DEBUG

#define CV_LOG_DEBUG (   tag,
  ... 
)    CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_DEBUG, __VA_ARGS__)

§ CV_LOG_ERROR

#define CV_LOG_ERROR (   tag,
  ... 
)    CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_ERROR, __VA_ARGS__)

§ CV_LOG_FATAL

#define CV_LOG_FATAL (   tag,
  ... 
)    CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_FATAL, __VA_ARGS__)

§ CV_LOG_INFO

#define CV_LOG_INFO (   tag,
  ... 
)    CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_INFO, __VA_ARGS__)

§ CV_LOG_STRIP_LEVEL

#define CV_LOG_STRIP_LEVEL   CV_LOG_LEVEL_VERBOSE

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,
  ... 
)    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,
  ... 
)

§ CV_LOG_WARNING

#define CV_LOG_WARNING (   tag,
  ... 
)    CV_LOG_WITH_TAG(tag, cv::utils::logging::LOG_LEVEL_WARNING, __VA_ARGS__)

§ CV_LOG_WITH_TAG

#define CV_LOG_WITH_TAG (   tag,
  msgLevel,
  ... 
)
Value:
for(;;) { \
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; \
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_temp_logstream.str().c_str()); \
break; \
}
#define CV_LOGTAG_GLOBAL
Definition: logger.hpp:107
#define CV_LOGTAG_PTR_CAST(expr)
Definition: logger.hpp:73
STL namespace.
"black box" representation of the file storage associated with a file on disk.
Definition: affine.hpp:51
#define CV_LOGTAG_FALLBACK
Definition: logger.hpp:101
#define CV_LOGTAG_EXPAND_NAME(tag)
Definition: logger.hpp:95
void writeLogMessageEx(LogLevel logLevel, const char *tag, const char *file, int line, const char *func, const char *message)
#define CV_LOG_STRIP_LEVEL
Definition: logger.hpp:69
LogLevel
Supported logging levels and their semantic.
Definition: logger.defines.hpp:25
#define CV_Func
Definition: cvdef.h:90

§ CV_LOGTAG_EXPAND_NAME

#define CV_LOGTAG_EXPAND_NAME (   tag)    tag

§ CV_LOGTAG_FALLBACK

#define CV_LOGTAG_FALLBACK   nullptr

§ CV_LOGTAG_GLOBAL

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

§ CV_LOGTAG_PTR_CAST

#define CV_LOGTAG_PTR_CAST (   expr)    static_cast<const cv::utils::logging::LogTag*>(expr)