Apply deprecate macro and LOG
[platform/core/uifw/dali-core.git] / dali / integration-api / debug.h
index b9d0019..828aa3a 100644 (file)
@@ -1,24 +1,26 @@
 #ifndef __DALI_INTEGRATION_DEBUG_H__
 #define __DALI_INTEGRATION_DEBUG_H__
 
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 // EXTERNAL INCLUDES
 #include <string>
+#include <sstream>
 #include <list>
 
 // INTERNAL INCLUDES
@@ -34,62 +36,23 @@ namespace Dali
 struct Vector2;
 struct Vector3;
 struct Vector4;
-struct Matrix3;
-struct Matrix;
-struct Quaternion;
+class Matrix3;
+class Matrix;
+class Quaternion;
 
 namespace Integration
 {
 namespace Log
 {
 
-// environment variable for enabling/disabling logging in different threads
-#define DALI_ENV_ENABLE_LOG "DALI_ENABLE_LOG"
-// values of the environment variable
-#define DALI_LOG_OFF               "FALSE"            ///< disable log messages from all threads. Do not log resource creation / destruction
-#define DALI_LOG_EVENT_THREAD      "EVENT"            ///< enable log messages from event thread. Do not log resource creation / destruction
-#define DALI_LOG_UPDATE_THREAD     "UPDATE"           ///< enable log messages from update thread. Do not log resource creation / destruction
-#define DALI_LOG_RENDER_THREAD     "RENDER"           ///< enable log messages from render thread. Do not log resource creation / destruction
-#define DALI_LOG_RESOURCE_THREADS  "RESOURCE_LOADER"  ///< enable log messages from render thread. Do not log resource creation / destruction
-#define DALI_LOG_ALL_THREADS       "ALL"              ///< enable log messages from all threads. Do not log resource creation / destruction
-#define DALI_LOG_RESOURCE_LIFETIME "RESOURCE_LOG"     ///< log resource creation / destruction. Enables logging on all threads.
-
-// environment variable for enabling/disabling fps tracking
-#define DALI_ENV_FPS_TRACKING "DALI_FPS_TRACKING"
-
-// environment variable for enabling/disabling fps tracking
-#define DALI_ENV_UPDATE_STATUS_INTERVAL "DALI_UPDATE_STATUS_INTERVAL"
-
 enum DebugPriority
 {
   DebugInfo,
   DebugWarning,
-  DebugError,
-  DebugResources
+  DebugError
 };
 
 /**
- * Control logging in separate threads.
- * If DEBUG_ENABLED macro is not defined, only errors and resource lifetime messages are logged.
- */
-enum LoggingOptions
-{
-  LogNone              = 0,
-  LogEventThread       = 1 << 0,
-  LogUpdateThread      = 1 << 1,
-  LogRenderThread      = 1 << 2,
-  LogResourceThreads   = 1 << 3,
-  LogResourceLifetime  = 1 << 4
-};
-
-/**
- * Return log settings (bitfield) based on the value set in environment
- * @param[in] setting the string contained in DALI_ENABLE_LOG env. variable (or NULL if not set)
- * @return a bitfield with all the relevant LoggingOptions values set
- */
-DALI_IMPORT_API unsigned int ParseLogOptions (const char* setting);
-
-/**
  * Used by logging macros to log a message along with function/class name
  * @param level debug level
  * @param format string format
@@ -108,7 +71,7 @@ typedef void (*LogFunction)(DebugPriority priority, std::string& message);
  * @param logFunction the log function to install
  * @param logOpts the log options to save in thread
  */
-DALI_IMPORT_API void InstallLogFunction(const LogFunction& logFunction, unsigned int logOpts);
+DALI_IMPORT_API void InstallLogFunction(const LogFunction& logFunction);
 
 /**
  * A log function has to be uninstalled for every thread that wants to use logging.
@@ -127,10 +90,7 @@ DALI_IMPORT_API void UninstallLogFunction();
 
 #define DALI_LOG_ERROR_NOFN(format, args...)     Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugError, format, ## args)
 
-/**
- * Provides unfiltered logging for resource usage
- */
-#define DALI_LOG_RESOURCE(format, args...)     Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugResources, format, ## args)
+#define DALI_LOG_WARNING_NOFN(format, args...)     Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugWarning, format, ## args)
 
 /**
  * Provides unfiltered logging for fps monitor
@@ -293,7 +253,6 @@ public:
   static Filter *gElement;
   static Filter *gActor;
   static Filter *gShader;
-  static Filter *gDynamics;
 
 private:
   LogLevel mLoggingLevel;
@@ -388,6 +347,19 @@ public: \
   std::string mDebugString;
 
 /**
+ * Print all the actor tree names
+ **/
+#define DALI_LOG_ACTOR_TREE( node ) { \
+  std::stringstream branch; \
+  Node* tempNode = node; \
+  while( tempNode ) { \
+    branch << "<" << tempNode->mDebugString << ">::"; \
+    tempNode = tempNode->GetParent(); \
+  } \
+  DALI_LOG_ERROR_NOFN("Actor tree: %s\n", branch.str().c_str()); \
+}
+
+/**
  * Allows one object to set another object's debug string
  */
 #define DALI_LOG_SET_OBJECT_STRING(object, string) (object->mDebugString = string)
@@ -416,6 +388,7 @@ public: \
 #else // DEBUG_ENABLED
 
 #define DALI_LOG_OBJECT_STRING_DECLARATION
+#define DALI_LOG_ACTOR_TREE(node)
 #define DALI_LOG_SET_OBJECT_STRING(object, string)
 #define DALI_LOG_FMT_OBJECT_STRING(object, fmt, args...)
 #define DALI_LOG_GET_OBJECT_STRING(object)