forked from opencv/opencv
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request opencv#6962 from alalek:fix_build_log_macro
- Loading branch information
Showing
4 changed files
with
64 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,4 +99,6 @@ | |
# include "opencv2/stitching/stitching_tegra.hpp" | ||
#endif | ||
|
||
#include "util_log.hpp" | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// This file is part of OpenCV project. | ||
// It is subject to the license terms in the LICENSE file found in the top-level directory | ||
// of this distribution and at http://opencv.org/license.html. | ||
|
||
#ifndef __OPENCV_STITCHING_UTIL_LOG_HPP__ | ||
#define __OPENCV_STITCHING_UTIL_LOG_HPP__ | ||
|
||
#ifndef ENABLE_LOG | ||
#define ENABLE_LOG 0 | ||
#endif | ||
|
||
// TODO remove LOG macros, add logging class | ||
#if ENABLE_LOG | ||
#ifdef ANDROID | ||
#include <iostream> | ||
#include <sstream> | ||
#include <android/log.h> | ||
#define LOG_STITCHING_MSG(msg) \ | ||
do { \ | ||
Stringstream _os; \ | ||
_os << msg; \ | ||
__android_log_print(ANDROID_LOG_DEBUG, "STITCHING", "%s", _os.str().c_str()); \ | ||
} while(0); | ||
#else | ||
#include <iostream> | ||
#define LOG_STITCHING_MSG(msg) for(;;) { std::cout << msg; std::cout.flush(); break; } | ||
#endif | ||
#else | ||
#define LOG_STITCHING_MSG(msg) | ||
#endif | ||
|
||
#define LOG_(_level, _msg) \ | ||
for(;;) \ | ||
{ \ | ||
using namespace std; \ | ||
if ((_level) >= ::cv::detail::stitchingLogLevel()) \ | ||
{ \ | ||
LOG_STITCHING_MSG(_msg); \ | ||
} \ | ||
break; \ | ||
} | ||
|
||
|
||
#define LOG(msg) LOG_(1, msg) | ||
#define LOG_CHAT(msg) LOG_(0, msg) | ||
|
||
#define LOGLN(msg) LOG(msg << std::endl) | ||
#define LOGLN_CHAT(msg) LOG_CHAT(msg << std::endl) | ||
|
||
//#if DEBUG_LOG_CHAT | ||
// #define LOG_CHAT(msg) LOG(msg) | ||
// #define LOGLN_CHAT(msg) LOGLN(msg) | ||
//#else | ||
// #define LOG_CHAT(msg) do{}while(0) | ||
// #define LOGLN_CHAT(msg) do{}while(0) | ||
//#endif | ||
|
||
#endif // __OPENCV_STITCHING_UTIL_LOG_HPP__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters