From 7f3d53912646227ba35376ba5e151df621f4cb27 Mon Sep 17 00:00:00 2001 From: Jihoon Chung Date: Sat, 20 Jul 2013 15:05:01 +0900 Subject: [PATCH] Add secure_log.h [Issue#] N/A [Problem] N/A [Cause] N/A [Solution] Add secure_log.h [SCMRequest] N/A Change-Id: I1bd92bccbadf45b1576c696a693a4628a707507e --- modules/log/config.cmake | 1 + modules/log/include/dpl/log/secure_log.h | 85 ++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 modules/log/include/dpl/log/secure_log.h diff --git a/modules/log/config.cmake b/modules/log/config.cmake index 26e35f6..30ad033 100644 --- a/modules/log/config.cmake +++ b/modules/log/config.cmake @@ -32,6 +32,7 @@ SET(DPL_LOG_HEADERS ${PROJECT_SOURCE_DIR}/modules/log/include/dpl/log/dlog_log_provider.h ${PROJECT_SOURCE_DIR}/modules/log/include/dpl/log/log.h ${PROJECT_SOURCE_DIR}/modules/log/include/dpl/log/old_style_log_provider.h + ${PROJECT_SOURCE_DIR}/modules/log/include/dpl/log/secure_log.h PARENT_SCOPE ) diff --git a/modules/log/include/dpl/log/secure_log.h b/modules/log/include/dpl/log/secure_log.h new file mode 100644 index 0000000..9d5fb43 --- /dev/null +++ b/modules/log/include/dpl/log/secure_log.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved + * + * 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. + */ +/** + * @file secure_log.h + * @author Jihoon Chung(jihoon.chung@samsung.com) + * @version 0.1 + * @brief + */ + +#ifndef DPL_SECURE_LOG_H +#define DPL_SECURE_LOG_H + +#include + +#define COLOR_ERROR "\e[1;31m" +#define COLOR_WARNING "\e[2;31m" +#define COLOR_END "\e[0m" +#define COLOR_TAG "\e[0m" + +#ifdef WRT_LOG +#undef LOG_TAG +#define LOG_TAG "WRT" +#undef COLOR_TAG +#define COLOR_TAG "\e[1;32m" +#endif + +#ifdef WRT_BUNDLE_LOG +#undef LOG_TAG +#define LOG_TAG "WRT_BUNDLE" +#undef COLOR_TAG +#define COLOR_TAG "\e[1;34m" +#endif + +#ifdef WRT_PLUGINS_COMMON_LOG +#undef LOG_TAG +#define LOG_TAG "WRT_PLUGINS/COMMON" +#undef COLOR_TAG +#define COLOR_TAG "\e[1;36m" +#endif + +#ifdef WRT_PLUGINS_WIDGET_LOG +#undef LOG_TAG +#define LOG_TAG "WRT_PLUGINS/WIDGET" +#undef COLOR_TAG +#define COLOR_TAG "\e[1;35m" +#endif + +#ifdef WRT_INSTALLER_LOG +#undef LOG_TAG +#define LOG_TAG "WRT_INSTALLER" +#undef COLOR_TAG +#define COLOR_TAG "\e[1;32m" +#endif + +#ifndef SECURE_SLOGD +#define SECURE_SLOGD(fmt, arg...) SLOGD(fmt,##arg) +#endif + +#ifndef SECURE_SLOGW +#define SECURE_SLOGW(fmt, arg...) SLOGW(fmt,##arg) +#endif + +#ifndef SECURE_SLOGE +#define SECURE_SLOGE(fmt, arg...) SLOGE(fmt,##arg) +#endif + +#define _D(fmt, arg ...) SECURE_SLOGD(COLOR_TAG fmt COLOR_END,##arg) +#define _W(fmt, arg ...) SECURE_SLOGW(COLOR_WARNING fmt COLOR_END,##arg) +#define _E(fmt, arg ...) SECURE_SLOGE(COLOR_ERROR fmt COLOR_END,##arg) + +#endif // DPL_SECURE_LOG_H + -- 2.7.4