From 821aa6d7ca85421f555300e241d8827e48baa511 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Thu, 17 Aug 2023 14:11:24 +0900 Subject: [PATCH 1/1] libsyscommon: Add common log.h to print log via dlog All system service uses the dlog to print the logging. So that add the common log.h file using dlog. Change-Id: Id3f594bb5607db807f8608670f9e60839146d917 Signed-off-by: Chanwoo Choi --- include/libsyscommon/log.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 include/libsyscommon/log.h diff --git a/include/libsyscommon/log.h b/include/libsyscommon/log.h new file mode 100644 index 0000000..0d7db18 --- /dev/null +++ b/include/libsyscommon/log.h @@ -0,0 +1,41 @@ +/* MIT License + * + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is furnished + * to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef __LOG_H__ +#define __LOG_H__ + +#ifdef ENABLE_DLOG +#include + +#define _D(fmt, args...) SLOGD(fmt, ##args) +#define _I(fmt, args...) SLOGI(fmt, ##args) +#define _W(fmt, args...) SLOGW(fmt, ##args) +#define _E(fmt, args...) SLOGE(fmt, ##args) +#else +#define _D(fmt, args...) do { } while(0) +#define _I(fmt, args...) do { } while(0) +#define _W(fmt, args...) do { } while(0) +#define _E(fmt, args...) do { } while(0) +#endif + +#endif /* __LOG_H__ */ -- 2.7.4