Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/stitching/src/util_log.hpp
16337 views
1
// This file is part of OpenCV project.
2
// It is subject to the license terms in the LICENSE file found in the top-level directory
3
// of this distribution and at http://opencv.org/license.html.
4
5
#ifndef __OPENCV_STITCHING_UTIL_LOG_HPP__
6
#define __OPENCV_STITCHING_UTIL_LOG_HPP__
7
8
#ifndef ENABLE_LOG
9
#define ENABLE_LOG 0
10
#endif
11
12
// TODO remove LOG macros, add logging class
13
#if ENABLE_LOG
14
#ifdef __ANDROID__
15
#include <iostream>
16
#include <sstream>
17
#include <android/log.h>
18
#define LOG_STITCHING_MSG(msg) \
19
do { \
20
Stringstream _os; \
21
_os << msg; \
22
__android_log_print(ANDROID_LOG_DEBUG, "STITCHING", "%s", _os.str().c_str()); \
23
} while(0);
24
#else
25
#include <iostream>
26
#define LOG_STITCHING_MSG(msg) for(;;) { std::cout << msg; std::cout.flush(); break; }
27
#endif
28
#else
29
#define LOG_STITCHING_MSG(msg)
30
#endif
31
32
#define LOG_(_level, _msg) \
33
for(;;) \
34
{ \
35
using namespace std; \
36
if ((_level) >= ::cv::detail::stitchingLogLevel()) \
37
{ \
38
LOG_STITCHING_MSG(_msg); \
39
} \
40
break; \
41
}
42
43
44
#define LOG(msg) LOG_(1, msg)
45
#define LOG_CHAT(msg) LOG_(0, msg)
46
47
#define LOGLN(msg) LOG(msg << std::endl)
48
#define LOGLN_CHAT(msg) LOG_CHAT(msg << std::endl)
49
50
//#if DEBUG_LOG_CHAT
51
// #define LOG_CHAT(msg) LOG(msg)
52
// #define LOGLN_CHAT(msg) LOGLN(msg)
53
//#else
54
// #define LOG_CHAT(msg) do{}while(0)
55
// #define LOGLN_CHAT(msg) do{}while(0)
56
//#endif
57
58
#endif // __OPENCV_STITCHING_UTIL_LOG_HPP__
59
60