diff mbox series

[BlueZ] log: Make error and warn log file and function information

Message ID 20200429210419.1569840-1-luiz.dentz@gmail.com (mailing list archive)
State New, archived
Headers show
Series [BlueZ] log: Make error and warn log file and function information | expand

Commit Message

Luiz Augusto von Dentz April 29, 2020, 9:04 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This makes it a lot simpler to find out where errors/warnings come from
and also remove the possibility of clashes when having multiple places
where the message would be exactly the same.
---
 src/log.c | 26 --------------------------
 src/log.h |  6 ++++--
 2 files changed, 4 insertions(+), 28 deletions(-)

Comments

bluez.test.bot@gmail.com April 29, 2020, 9:35 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While we are preparing for reviewing the patches, we found the following
issue/warning.


Test Result:
Checkpatch Failed

Patch Title:
[BlueZ] log: Make error and warn log file and function information

Output:
ERROR:SPACING: space prohibited before that ',' (ctx:WxW)
#65: FILE: src/log.h:73:
+	btd_error(0xffff, "%s:%s() " fmt, __FILE__, __func__ , ## arg)
 	                                                     ^

ERROR:SPACING: space prohibited before that ',' (ctx:WxW)
#67: FILE: src/log.h:75:
+	btd_warn(0xffff, "%s:%s() " fmt, __FILE__, __func__ , ## arg)
 	                                                    ^

- total: 2 errors, 0 warnings, 47 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Your patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPLIT_STRING

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.



For more details about BlueZ coding style guide, please find it
in doc/coding-style.txt

---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/src/log.c b/src/log.c
index 11d26d508..a42c5941d 100644
--- a/src/log.c
+++ b/src/log.c
@@ -53,32 +53,6 @@  static void monitor_log(uint16_t index, int priority,
 	bt_log_vprintf(index, LOG_IDENT, priority, format, ap);
 }
 
-void error(const char *format, ...)
-{
-	va_list ap;
-
-	va_start(ap, format);
-	vsyslog(LOG_ERR, format, ap);
-	va_end(ap);
-
-	va_start(ap, format);
-	monitor_log(HCI_DEV_NONE, LOG_ERR, format, ap);
-	va_end(ap);
-}
-
-void warn(const char *format, ...)
-{
-	va_list ap;
-
-	va_start(ap, format);
-	vsyslog(LOG_WARNING, format, ap);
-	va_end(ap);
-
-	va_start(ap, format);
-	monitor_log(HCI_DEV_NONE, LOG_WARNING, format, ap);
-	va_end(ap);
-}
-
 void info(const char *format, ...)
 {
 	va_list ap;
diff --git a/src/log.h b/src/log.h
index 0d243ceca..73240e259 100644
--- a/src/log.h
+++ b/src/log.h
@@ -23,8 +23,6 @@ 
 
 #include <stdint.h>
 
-void error(const char *format, ...) __attribute__((format(printf, 1, 2)));
-void warn(const char *format, ...) __attribute__((format(printf, 1, 2)));
 void info(const char *format, ...) __attribute__((format(printf, 1, 2)));
 
 void btd_log(uint16_t index, int priority, const char *format, ...)
@@ -71,3 +69,7 @@  void __btd_enable_debug(struct btd_debug_desc *start,
 } while (0)
 
 #define DBG(fmt, arg...) DBG_IDX(0xffff, fmt, ## arg)
+#define error(fmt, arg...) \
+	btd_error(0xffff, "%s:%s() " fmt, __FILE__, __func__ , ## arg)
+#define warn(fmt, arg...) \
+	btd_warn(0xffff, "%s:%s() " fmt, __FILE__, __func__ , ## arg)