1 #ifndef __DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_DEBUG_H__
2 #define __DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_DEBUG_H__
5 * Copyright (c) 2015 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>
35 // Uncomment next line for FULL logging of the ThreadSynchronization class in release mode
36 //#define RELEASE_BUILD_LOGGING
40 #define ENABLE_LOG_IN_COLOR
41 #define ENABLE_COUNTER_LOGGING
42 #define ENABLE_UPDATE_RENDER_THREAD_LOGGING
43 #define ENABLE_EVENT_LOGGING
45 #define DEBUG_LEVEL_COUNTER Debug::Verbose
46 #define DEBUG_LEVEL_UPDATE_RENDER Debug::General
47 #define DEBUG_LEVEL_EVENT Debug::Concise
49 Debug::Filter* gLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_THREAD_SYNC" );
51 #define LOG_THREAD_SYNC(level, color, format, args...) \
52 DALI_LOG_INFO( gLogFilter, level, "%s" format "%s\n", color, ## args, COLOR_CLEAR )
54 #define LOG_THREAD_SYNC_TRACE(color) \
55 Dali::Integration::Log::TraceObj debugTraceObj( gLogFilter, "%s%s%s", color, __FUNCTION__, COLOR_CLEAR ); \
56 if( ! gLogFilter->IsTraceEnabled() ) { LOG_THREAD_SYNC( Debug::Concise, color, "%s", __FUNCTION__ ); }
58 #define LOG_THREAD_SYNC_TRACE_FMT(color, format, args...) \
59 Dali::Integration::Log::TraceObj debugTraceObj( gLogFilter, "%s%s: " format "%s", color, __FUNCTION__, ## args, COLOR_CLEAR ); \
60 if( ! gLogFilter->IsTraceEnabled() ) { LOG_THREAD_SYNC( Debug::Concise, color, "%s: " format, __FUNCTION__, ## args ); }
62 #elif defined( RELEASE_BUILD_LOGGING )
64 #define ENABLE_LOG_IN_COLOR
65 #define ENABLE_COUNTER_LOGGING
66 #define ENABLE_UPDATE_RENDER_THREAD_LOGGING
67 #define ENABLE_EVENT_LOGGING
69 #define DEBUG_LEVEL_COUNTER 0
70 #define DEBUG_LEVEL_UPDATE_RENDER 0
71 #define DEBUG_LEVEL_EVENT 0
73 #define LOG_THREAD_SYNC(level, color, format, args...) \
74 Dali::Integration::Log::LogMessage( Dali::Integration::Log::DebugInfo, "%s" format "%s\n", color, ## args, COLOR_CLEAR )
76 #define LOG_THREAD_SYNC_TRACE(color) \
77 Dali::Integration::Log::LogMessage( Dali::Integration::Log::DebugInfo, "%s%s%s\n", color, __FUNCTION__, COLOR_CLEAR )
79 #define LOG_THREAD_SYNC_TRACE_FMT(color, format, args...) \
80 Dali::Integration::Log::LogMessage( Dali::Integration::Log::DebugInfo, "%s%s: " format "%s\n", color, __FUNCTION__, ## args, COLOR_CLEAR )
84 #define LOG_THREAD_SYNC(level, color, format, args...)
85 #define LOG_THREAD_SYNC_TRACE(color)
86 #define LOG_THREAD_SYNC_TRACE_FMT(color, format, args...)
88 #endif // DEBUG_ENABLED
90 #ifdef ENABLE_LOG_IN_COLOR
91 #define COLOR_YELLOW "\033[33m"
92 #define COLOR_LIGHT_RED "\033[91m"
93 #define COLOR_LIGHT_YELLOW "\033[93m"
94 #define COLOR_WHITE "\033[97m"
95 #define COLOR_CLEAR "\033[0m"
98 #define COLOR_LIGHT_RED
99 #define COLOR_LIGHT_YELLOW
104 #ifdef ENABLE_COUNTER_LOGGING
105 #define LOG_COUNTER_EVENT(format, args...) LOG_THREAD_SYNC(DEBUG_LEVEL_COUNTER, COLOR_LIGHT_RED, "%s: " format, __FUNCTION__, ## args)
106 #define LOG_COUNTER_UPDATE_RENDER(format, args...) LOG_THREAD_SYNC(DEBUG_LEVEL_COUNTER, COLOR_LIGHT_YELLOW, "%s: " format, __FUNCTION__, ## args)
108 #define LOG_COUNTER_EVENT(format, args...)
109 #define LOG_COUNTER_UPDATE_RENDER(format, args...)
112 #ifdef ENABLE_UPDATE_RENDER_THREAD_LOGGING
113 #define LOG_UPDATE_RENDER(format, args...) LOG_THREAD_SYNC(DEBUG_LEVEL_UPDATE_RENDER, COLOR_YELLOW, "%s: " format, __FUNCTION__, ## args)
114 #define LOG_UPDATE_RENDER_TRACE LOG_THREAD_SYNC_TRACE(COLOR_YELLOW)
115 #define LOG_UPDATE_RENDER_TRACE_FMT(format, args...) LOG_THREAD_SYNC_TRACE_FMT(COLOR_YELLOW, format, ## args)
117 #define LOG_UPDATE_RENDER(format, args...)
118 #define LOG_UPDATE_RENDER_TRACE
119 #define LOG_UPDATE_RENDER_TRACE_FMT(format, args...)
122 #ifdef ENABLE_EVENT_LOGGING
123 #define LOG_EVENT(format, args...) LOG_THREAD_SYNC(DEBUG_LEVEL_EVENT, COLOR_WHITE, "%s: " format, __FUNCTION__, ## args)
124 #define LOG_EVENT_TRACE LOG_THREAD_SYNC_TRACE(COLOR_WHITE)
125 #define LOG_EVENT_TRACE_FMT(format, args...) LOG_THREAD_SYNC_TRACE_FMT(COLOR_WHITE, format, ## args)
127 #define LOG_EVENT(format, args...)
128 #define LOG_EVENT_TRACE
129 #define LOG_EVENT_TRACE_FMT(format, args...)
132 } // unnamed namespace
134 } // namespace Adaptor
136 } // namespace Internal
140 #endif // __DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_DEBUG_H__