libsyscommon: Add common log.h to print log via dlog 36/297336/1
authorChanwoo Choi <cw00.choi@samsung.com>
Thu, 17 Aug 2023 05:11:24 +0000 (14:11 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Thu, 17 Aug 2023 05:11:24 +0000 (14:11 +0900)
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 <cw00.choi@samsung.com>
include/libsyscommon/log.h [new file with mode: 0644]

diff --git a/include/libsyscommon/log.h b/include/libsyscommon/log.h
new file mode 100644 (file)
index 0000000..0d7db18
--- /dev/null
@@ -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 <dlog.h>
+
+#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__ */