Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
Loading...
Searching...
No Matches
easyloggingpp.h
Go to the documentation of this file.
1// License: Apache 2.0. See LICENSE file in root directory.
2// Copyright(c) 2021 Intel Corporation. All Rights Reserved.
3
4#pragma once
5
6// When including this file outside LibRealSense you also need to:
7// 1. Compile the easylogging++.cc file
8// 2. With static linkage, ELPP is initialized by librealsense, so doing it here will
9// create errors. When we're using the shared .so/.dll, the two are separate and we have
10// to initialize ours if we want to use the APIs!
11// Use this code snippet:
12//
13//#include <easylogging++.h>
14//#ifdef BUILD_SHARED_LIBS
15//INITIALIZE_EASYLOGGINGPP
16//#endif
17
18// you can use 'include(easyloggingpp.cmake)' for setting required includes and sources variables,
19// and then use '${ELPP_SOURCES}' and '${ELPP_INCLUDES}' CMake variable to add to your target
20
21#if BUILD_EASYLOGGINGPP
22#include <third-party/easyloggingpp/src/easylogging++.h>
23
24
25#ifdef __ANDROID__
26#include <android/log.h>
27#include <sstream>
28
29#define ANDROID_LOG_TAG "librs"
30
31#define LOG_INFO(...) do { std::ostringstream ss; ss << __VA_ARGS__; __android_log_write( ANDROID_LOG_INFO, ANDROID_LOG_TAG, ss.str().c_str() ); } while(false)
32#define LOG_WARNING(...) do { std::ostringstream ss; ss << __VA_ARGS__; __android_log_write( ANDROID_LOG_WARN, ANDROID_LOG_TAG, ss.str().c_str() ); } while(false)
33#define LOG_ERROR(...) do { std::ostringstream ss; ss << __VA_ARGS__; __android_log_write( ANDROID_LOG_ERROR, ANDROID_LOG_TAG, ss.str().c_str() ); } while(false)
34#define LOG_FATAL(...) do { std::ostringstream ss; ss << __VA_ARGS__; __android_log_write( ANDROID_LOG_ERROR, ANDROID_LOG_TAG, ss.str().c_str() ); } while(false)
35#ifdef NDEBUG
36#define LOG_DEBUG(...)
37#else
38#define LOG_DEBUG(...) do { std::ostringstream ss; ss << __VA_ARGS__; __android_log_write( ANDROID_LOG_DEBUG, ANDROID_LOG_TAG, ss.str().c_str() ); } while(false)
39#endif
40
41#else //__ANDROID__
42
43#define LOG_DEBUG(...) do { CLOG(DEBUG ,"librealsense") << __VA_ARGS__; } while(false)
44#define LOG_INFO(...) do { CLOG(INFO ,"librealsense") << __VA_ARGS__; } while(false)
45#define LOG_WARNING(...) do { CLOG(WARNING ,"librealsense") << __VA_ARGS__; } while(false)
46#define LOG_ERROR(...) do { CLOG(ERROR ,"librealsense") << __VA_ARGS__; } while(false)
47#define LOG_FATAL(...) do { CLOG(FATAL ,"librealsense") << __VA_ARGS__; } while(false)
48
49#endif // __ANDROID__
50
51
52#else // BUILD_EASYLOGGINGPP
53
54
55#define LOG_DEBUG(...) do { ; } while(false)
56#define LOG_INFO(...) do { ; } while(false)
57#define LOG_WARNING(...) do { ; } while(false)
58#define LOG_ERROR(...) do { ; } while(false)
59#define LOG_FATAL(...) do { ; } while(false)
60
61
62#endif // BUILD_EASYLOGGINGPP