Modified to send show_notification message when mobile is disconnected
[platform/core/uifw/capi-ui-sticker.git] / receiver / inc / log.h
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __debug_H__
18 #define __debug_H__
19
20 #include <dlog.h>
21 #include <sys/types.h>
22 #include <unistd.h>
23
24 #undef LOG_TAG
25 #define LOG_TAG "STICKER_RECEIVER"
26
27 void sticker_save_log (const char *fmt, ...);
28
29 #define _STICKER_RECEIVER_LOG(logLevel, fmt, ...) do {           \
30         dlog_print(logLevel, LOG_TAG, "%s : %s(%d) > " fmt, rindex(__FILE__, '/')+1, __FUNCTION__, __LINE__, ##__VA_ARGS__);    \
31         sticker_save_log("pid(%d) %s : %s(%d) > " fmt, getpid(), rindex(__FILE__, '/')+1, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
32 } while (0)
33
34 #undef LOGD
35 #define LOGD(format, arg...) _STICKER_RECEIVER_LOG(DLOG_DEBUG, format, ##arg)
36
37 #undef LOGI
38 #define LOGI(format, arg...) _STICKER_RECEIVER_LOG(DLOG_INFO, format, ##arg)
39
40 #undef LOGW
41 #define LOGW(format, arg...) _STICKER_RECEIVER_LOG(DLOG_WARN, format, ##arg)
42
43 #undef LOGE
44 #define LOGE(format, arg...) _STICKER_RECEIVER_LOG(DLOG_ERROR, format, ##arg)
45
46 #undef LOGF
47 #define LOGF(format, arg...) _STICKER_RECEIVER_LOG(DLOG_FATAL, format, ##arg)
48
49 #endif /* __debug_H__ */