summaryrefslogtreecommitdiff
path: root/src/include/util/media-thumb-debug.h
blob: caf3020bc1fa049362102397174d1551c2fc4ce7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
 * libmedia-thumbnail
 *
 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact: Hyunjun Ko <zzoon.ko@samsung.com>
 *
 * 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.
 *
 */

#ifndef _MEDIA_THUMB_DEBUG_H_
#define _MEDIA_THUMB_DEBUG_H_

#include <stdio.h>
#include <stdlib.h>
#include <dlog.h>

#include <unistd.h>
#include <asm/unistd.h>
#include <errno.h>

#ifdef LOG_TAG
#undef LOG_TAG
#endif

#define LOG_TAG "MEDIA_THUMBNAIL"

#define FONT_COLOR_RESET    "\033[0m"
#define FONT_COLOR_RED      "\033[31m"
#define FONT_COLOR_GREEN    "\033[32m"
#define FONT_COLOR_YELLOW   "\033[33m"
#define FONT_COLOR_BLUE     "\033[34m"
#define FONT_COLOR_PURPLE   "\033[35m"
#define FONT_COLOR_CYAN     "\033[36m"
#define FONT_COLOR_GRAY     "\033[37m"

#define thumb_dbg(fmt, arg...)	do { \
		LOGD(FONT_COLOR_RESET fmt "\n", ##arg); \
		} while (0)

#define thumb_warn(fmt, arg...)	do { \
		LOGW(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
		} while (0)

#define thumb_err(fmt, arg...)	do { \
		 LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
		} while (0)

#define thumb_dbg_slog(fmt, arg...)	do { \
		SECURE_LOGD(FONT_COLOR_CYAN""fmt""FONT_COLOR_RESET, ##arg); \
		} while (0)

#define thumb_warn_slog(fmt, arg...)	do { \
		SECURE_LOGW(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
		} while (0)

#define thumb_err_slog(fmt, arg...) do { \
		SECURE_LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
		} while (0)

#define ERR_BUF_LENGHT 256
#define thumb_stderror(fmt) do { \
			char thumb_stderror_buffer[ERR_BUF_LENGHT] = {0,}; \
			LOGE(FONT_COLOR_RED fmt" : standard error [%s]", strerror_r(errno, thumb_stderror_buffer, ERR_BUF_LENGHT)); \
		} while (0)

#define thumb_retm_if(expr, fmt, arg...) do { \
				if (expr) { \
					LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
					return; \
				} \
			} while (0)
#define thumb_retv_if(expr, val) do { \
				if (expr) { \
					LOGE(FONT_COLOR_RED""FONT_COLOR_RESET); \
					return (val); \
				} \
			} while (0)
#define thumb_retvm_if(expr, val, fmt, arg...) do { \
				if (expr) { \
					LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
					return (val); \
				} \
			} while (0)

#ifdef _PERFORMANCE_CHECK_
long
thumb_get_debug_time(void);
void
thumb_reset_debug_time(void);
void
thumb_print_debug_time(char* time_string);
void
thumb_print_debug_time_ex(long start, long end, const char* func_name, char* time_string);
#endif

#endif /*_MEDIA_THUMB_DEBUG_H_*/