Path: blob/master/modules/stitching/src/util_log.hpp
16337 views
// This file is part of OpenCV project.1// It is subject to the license terms in the LICENSE file found in the top-level directory2// of this distribution and at http://opencv.org/license.html.34#ifndef __OPENCV_STITCHING_UTIL_LOG_HPP__5#define __OPENCV_STITCHING_UTIL_LOG_HPP__67#ifndef ENABLE_LOG8#define ENABLE_LOG 09#endif1011// TODO remove LOG macros, add logging class12#if ENABLE_LOG13#ifdef __ANDROID__14#include <iostream>15#include <sstream>16#include <android/log.h>17#define LOG_STITCHING_MSG(msg) \18do { \19Stringstream _os; \20_os << msg; \21__android_log_print(ANDROID_LOG_DEBUG, "STITCHING", "%s", _os.str().c_str()); \22} while(0);23#else24#include <iostream>25#define LOG_STITCHING_MSG(msg) for(;;) { std::cout << msg; std::cout.flush(); break; }26#endif27#else28#define LOG_STITCHING_MSG(msg)29#endif3031#define LOG_(_level, _msg) \32for(;;) \33{ \34using namespace std; \35if ((_level) >= ::cv::detail::stitchingLogLevel()) \36{ \37LOG_STITCHING_MSG(_msg); \38} \39break; \40}414243#define LOG(msg) LOG_(1, msg)44#define LOG_CHAT(msg) LOG_(0, msg)4546#define LOGLN(msg) LOG(msg << std::endl)47#define LOGLN_CHAT(msg) LOG_CHAT(msg << std::endl)4849//#if DEBUG_LOG_CHAT50// #define LOG_CHAT(msg) LOG(msg)51// #define LOGLN_CHAT(msg) LOGLN(msg)52//#else53// #define LOG_CHAT(msg) do{}while(0)54// #define LOGLN_CHAT(msg) do{}while(0)55//#endif5657#endif // __OPENCV_STITCHING_UTIL_LOG_HPP__585960