1 #ifndef DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_DEBUG_H
2 #define DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_DEBUG_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/integration-api/debug.h>
32 // Uncomment next line for FULL logging of the ThreadSynchronization class in release mode
33 //#define RELEASE_BUILD_LOGGING
37 #define ENABLE_LOG_IN_COLOR
38 #define ENABLE_COUNTER_LOGGING
39 #define ENABLE_UPDATE_RENDER_THREAD_LOGGING
40 #define ENABLE_EVENT_LOGGING
42 #define DEBUG_LEVEL_COUNTER Debug::Verbose
43 #define DEBUG_LEVEL_UPDATE_RENDER Debug::General
44 #define DEBUG_LEVEL_EVENT Debug::Concise
46 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_THREAD_SYNC");
48 #define LOG_THREAD_SYNC(level, color, format, ...) \
49 DALI_LOG_INFO(gLogFilter, level, "%s" format "%s\n", color, ##__VA_ARGS__, COLOR_CLEAR)
51 #define LOG_THREAD_SYNC_TRACE(color) \
52 Dali::Integration::Log::TraceObj debugTraceObj(gLogFilter, "%s%s%s", color, __FUNCTION__, COLOR_CLEAR); \
53 if(!gLogFilter->IsTraceEnabled()) \
55 LOG_THREAD_SYNC(Debug::Concise, color, "%s", __FUNCTION__); \
58 #define LOG_THREAD_SYNC_TRACE_FMT(color, format, ...) \
59 Dali::Integration::Log::TraceObj debugTraceObj(gLogFilter, "%s%s: " format "%s", color, __FUNCTION__, ##__VA_ARGS__, COLOR_CLEAR); \
60 if(!gLogFilter->IsTraceEnabled()) \
62 LOG_THREAD_SYNC(Debug::Concise, color, "%s: " format, __FUNCTION__, ##__VA_ARGS__); \
65 #elif defined(RELEASE_BUILD_LOGGING)
67 #define ENABLE_LOG_IN_COLOR
68 #define ENABLE_COUNTER_LOGGING
69 #define ENABLE_UPDATE_RENDER_THREAD_LOGGING
70 #define ENABLE_EVENT_LOGGING
72 #define DEBUG_LEVEL_COUNTER 0
73 #define DEBUG_LEVEL_UPDATE_RENDER 0
74 #define DEBUG_LEVEL_EVENT 0
76 #define LOG_THREAD_SYNC(level, color, format, ...) \
77 Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, "%s" format "%s\n", color, ##__VA_ARGS__, COLOR_CLEAR)
79 #define LOG_THREAD_SYNC_TRACE(color) \
80 Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, "%s%s%s\n", color, __FUNCTION__, COLOR_CLEAR)
82 #define LOG_THREAD_SYNC_TRACE_FMT(color, format, ...) \
83 Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugInfo, "%s%s: " format "%s\n", color, __FUNCTION__, ##__VA_ARGS__, COLOR_CLEAR)
87 #define LOG_THREAD_SYNC(level, color, format, ...)
88 #define LOG_THREAD_SYNC_TRACE(color)
89 #define LOG_THREAD_SYNC_TRACE_FMT(color, format, ...)
91 #endif // DEBUG_ENABLED
93 #ifdef ENABLE_LOG_IN_COLOR
94 #define COLOR_YELLOW "\033[33m"
95 #define COLOR_LIGHT_RED "\033[91m"
96 #define COLOR_LIGHT_YELLOW "\033[93m"
97 #define COLOR_WHITE "\033[97m"
98 #define COLOR_CLEAR "\033[0m"
101 #define COLOR_LIGHT_RED
102 #define COLOR_LIGHT_YELLOW
107 #ifdef ENABLE_COUNTER_LOGGING
108 #define LOG_COUNTER_EVENT(format, ...) LOG_THREAD_SYNC(DEBUG_LEVEL_COUNTER, COLOR_LIGHT_RED, "%s: " format, __FUNCTION__, ##__VA_ARGS__)
109 #define LOG_COUNTER_UPDATE_RENDER(format, ...) LOG_THREAD_SYNC(DEBUG_LEVEL_COUNTER, COLOR_LIGHT_YELLOW, "%s: " format, __FUNCTION__, ##__VA_ARGS__)
111 #define LOG_COUNTER_EVENT(format, ...)
112 #define LOG_COUNTER_UPDATE_RENDER(format, ...)
115 #ifdef ENABLE_UPDATE_RENDER_THREAD_LOGGING
116 #define LOG_UPDATE_RENDER(format, ...) LOG_THREAD_SYNC(DEBUG_LEVEL_UPDATE_RENDER, COLOR_YELLOW, "%s: " format, __FUNCTION__, ##__VA_ARGS__)
117 #define LOG_UPDATE_RENDER_TRACE LOG_THREAD_SYNC_TRACE(COLOR_YELLOW)
118 #define LOG_UPDATE_RENDER_TRACE_FMT(format, ...) LOG_THREAD_SYNC_TRACE_FMT(COLOR_YELLOW, format, ##__VA_ARGS__)
120 #define LOG_UPDATE_RENDER(format, ...)
121 #define LOG_UPDATE_RENDER_TRACE
122 #define LOG_UPDATE_RENDER_TRACE_FMT(format, ...)
125 #ifdef ENABLE_EVENT_LOGGING
126 #define LOG_EVENT(format, ...) LOG_THREAD_SYNC(DEBUG_LEVEL_EVENT, COLOR_WHITE, "%s: " format, __FUNCTION__, ##__VA_ARGS__)
127 #define LOG_EVENT_TRACE LOG_THREAD_SYNC_TRACE(COLOR_WHITE)
128 #define LOG_EVENT_TRACE_FMT(format, ...) LOG_THREAD_SYNC_TRACE_FMT(COLOR_WHITE, format, ##__VA_ARGS__)
130 #define LOG_EVENT(format, ...)
131 #define LOG_EVENT_TRACE
132 #define LOG_EVENT_TRACE_FMT(format, ...)
135 } // unnamed namespace
137 } // namespace Adaptor
139 } // namespace Internal
143 #endif // DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_DEBUG_H