#ifndef _LIBPUI_COMMON_H_
#define _LIBPUI_COMMON_H_
+int _pui_log_level;
+
typedef enum {
PUI_ERROR_NONE,
PUI_ERROR_INVALID_ANI_HANDLE,
PUI_INT_ERROR_UNKNOWN,
} pui_int_error;
+typedef enum {
+ PUI_LOG_LEVEL_INFO,
+ PUI_LOG_LEVEL_DEBUG,
+ PUI_LOG_LEVEL_ERROR,
+} pui_log_level;
+
typedef unsigned int pui_bool;
typedef char* pui_id;
typedef char* pui_error_string;
};
#define pui_err(msg, ...) \
- do { \
- fprintf(stderr, "[ERROR][%s][%d] " msg, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
+ do { \
+ if (_pui_log_level <= PUI_LOG_LEVEL_ERROR) \
+ fprintf(stderr, "[ERROR][%s][%d] " msg, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
} while(0)
-#define pui_warn(msg, ...) \
- do { \
- fprintf(stderr, "[WARNING][%s][%d] " msg, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
+#define pui_debug(msg, ...) \
+ do { \
+ if (_pui_log_level <= PUI_LOG_LEVEL_DEBUG) \
+ fprintf(stdout, "[DEBUG][%s][%d] " msg, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
} while(0)
#define pui_info(msg, ...) \
- do { \
- fprintf(stdout, "[INFO][%s][%d] " msg, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
+ do { \
+ if (_pui_log_level <= PUI_LOG_LEVEL_INFO) \
+ fprintf(stdout, "[INFO][%s][%d] " msg, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
} while(0)
#endif//_LIBPUI_COMMON_H_
if (handle->current_surface)
{
- pui_warn("Current_surface is not used !\n");
+ pui_debug("[GET BUFFER] Current_surface is not used !\n");
}
if (!tbm_surface_queue_can_dequeue(handle->tbm_queue, 0))
{
- pui_err("Failed to dequeue a tbm_surface !\n");
+ pui_err("[GET BUFFER] Failed to dequeue a tbm_surface !\n");
return NULL;
}
if (ret != TBM_SURFACE_ERROR_NONE)
{
- pui_err("[UPDATE] dequeue err:%d\n", ret);
+ pui_err("[GET BUFFER] Dequeue err:%d\n", ret);
return NULL;
}
if (!handle->is_buffer_set)
{
- pui_err("Buffer is not set !\n");
+ pui_err("[UPDATE] Buffer is not set !\n");
return PUI_ERROR_INVALID_BUFFER;
}
int
pui_init(void)
{
+ const char *cp = NULL;
+
if (++_pui_init_count != 1)
return _pui_init_count;
+ _pui_log_level = PUI_LOG_LEVEL_DEBUG;
+
+ cp = getenv("LIBPUI_LOG_LEVEL");
+
+ if (cp)
+ {
+ _pui_log_level = atoi(cp);
+ }
+
if (pui_module)
{
pui_err("Invalid calling of pui_init() !\n");