/* * libmedia-thumbnail * * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: Hyunjun Ko * * 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 #include #include #include #include #include #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) #endif /*_MEDIA_THUMB_DEBUG_H_*/