_dbus_system_log: rename to _dbus_log
authorSimon McVittie <smcv@debian.org>
Wed, 20 Jul 2016 07:55:14 +0000 (08:55 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Thu, 11 Aug 2016 15:41:16 +0000 (16:41 +0100)
This is a step towards making it write to either stderr or syslog
or both, as configured globally.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97009

bus/bus.c
bus/config-parser.c
dbus/dbus-sysdeps-unix.c
dbus/dbus-sysdeps-win.c
dbus/dbus-sysdeps.c
dbus/dbus-sysdeps.h
test/internals/syslog.c

index b8db6d8..9996be2 100644 (file)
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -1378,12 +1378,12 @@ bus_context_log (BusContext *context, DBusSystemLogSeverity severity, const char
       if (!_dbus_string_append_printf_valist (&full_msg, msg, args))
         goto oom_out;
 
-      _dbus_system_log (severity, "%s", _dbus_string_get_const_data (&full_msg));
+      _dbus_log (severity, "%s", _dbus_string_get_const_data (&full_msg));
     oom_out:
       _dbus_string_free (&full_msg);
     }
   else
-    _dbus_system_logv (severity, msg, args);
+    _dbus_logv (severity, msg, args);
 
 out:
   va_end (args);
@@ -1411,8 +1411,7 @@ bus_context_log_literal (BusContext            *context,
     }
   else
     {
-      _dbus_system_log (severity, "%s%s", nonnull (context->log_prefix, ""),
-                        msg);
+      _dbus_log (severity, "%s%s", nonnull (context->log_prefix, ""), msg);
     }
 }
 
index adba69e..8072f59 100644 (file)
@@ -2315,10 +2315,10 @@ include_dir (BusConfigParser   *parser,
                    * this bus is going to want to write to syslog! (There's
                    * also some layer inversion going on, if we want to use
                    * the bus context.) */
-                  _dbus_system_log (DBUS_SYSTEM_LOG_INFO,
-                                    "Encountered error '%s' while parsing '%s'\n",
-                                    error->message,
-                                    _dbus_string_get_const_data (&full_path));
+                  _dbus_log (DBUS_SYSTEM_LOG_INFO,
+                             "Encountered error '%s' while parsing '%s'\n",
+                             error->message,
+                             _dbus_string_get_const_data (&full_path));
                   dbus_error_free (error);
                 }
             }
index 381e2fc..1f964b5 100644 (file)
@@ -4565,7 +4565,9 @@ _dbus_init_system_log (const char *tag,
  * with an error code.
  */
 void
-_dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args)
+_dbus_logv (DBusSystemLogSeverity  severity,
+            const char            *msg,
+            va_list                args)
 {
   va_list tmp;
 #ifdef HAVE_SYSLOG_H
index efd3d54..32b49b8 100644 (file)
@@ -3662,7 +3662,9 @@ _dbus_init_system_log (const char  *tag,
  * with an error code.
  */
 void
-_dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args)
+_dbus_logv (DBusSystemLogSeverity  severity,
+            const char            *msg,
+            va_list                args)
 {
   char *s = "";
   char buf[1024];
index 23ffc86..d004ff0 100644 (file)
@@ -758,13 +758,15 @@ _dbus_strerror_from_errno (void)
  * @param msg a printf-style format string
  */
 void
-_dbus_system_log (DBusSystemLogSeverity severity, const char *msg, ...)
+_dbus_log (DBusSystemLogSeverity  severity,
+           const char            *msg,
+           ...)
 {
   va_list args;
 
   va_start (args, msg);
 
-  _dbus_system_logv (severity, msg, args);
+  _dbus_logv (severity, msg, args);
 
   va_end (args);
 }
index d5594c7..beb2f1e 100644 (file)
@@ -567,9 +567,13 @@ typedef enum {
 } DBusSystemLogSeverity;
 
 DBUS_PRIVATE_EXPORT
-void _dbus_system_log (DBusSystemLogSeverity severity, const char *msg, ...) _DBUS_GNUC_PRINTF (2, 3);
+void _dbus_log  (DBusSystemLogSeverity  severity,
+                 const char            *msg,
+                 ...) _DBUS_GNUC_PRINTF (2, 3);
 DBUS_PRIVATE_EXPORT
-void _dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args);
+void _dbus_logv (DBusSystemLogSeverity  severity,
+                 const char            *msg,
+                 va_list args);
 
 /* Define DBUS_VA_COPY() to do the right thing for copying va_list variables.
  * config.h may have already defined DBUS_VA_COPY as va_copy or __va_copy.
index c0c1f91..c2467be 100644 (file)
@@ -47,7 +47,7 @@ setup (Fixture *f,
 
 /* hopefully clear enough that people don't think these messages in syslog
  * are a bug */
-#define MESSAGE "regression test for _dbus_system_log(): "
+#define MESSAGE "regression test for _dbus_log(): "
 
 static void
 test_syslog (Fixture *f,
@@ -57,7 +57,7 @@ test_syslog (Fixture *f,
   if (g_test_trap_fork (0, 0))
     {
       _dbus_init_system_log ("test-syslog", FALSE);
-      _dbus_system_log (DBUS_SYSTEM_LOG_FATAL, MESSAGE "%d", 23);
+      _dbus_log (DBUS_SYSTEM_LOG_FATAL, MESSAGE "%d", 23);
       /* should not be reached: exit 0 so the assertion in the main process
        * will fail */
       exit (0);
@@ -69,9 +69,9 @@ test_syslog (Fixture *f,
   if (g_test_trap_fork (0, 0))
     {
       _dbus_init_system_log ("test-syslog", FALSE);
-      _dbus_system_log (DBUS_SYSTEM_LOG_INFO, MESSAGE "%d", 42);
-      _dbus_system_log (DBUS_SYSTEM_LOG_WARNING, MESSAGE "%d", 45);
-      _dbus_system_log (DBUS_SYSTEM_LOG_SECURITY, MESSAGE "%d", 666);
+      _dbus_log (DBUS_SYSTEM_LOG_INFO, MESSAGE "%d", 42);
+      _dbus_log (DBUS_SYSTEM_LOG_WARNING, MESSAGE "%d", 45);
+      _dbus_log (DBUS_SYSTEM_LOG_SECURITY, MESSAGE "%d", 666);
       exit (0);
     }
 
@@ -80,9 +80,9 @@ test_syslog (Fixture *f,
 #endif
   /* manual test (this is the best we can do on Windows) */
   _dbus_init_system_log ("test-syslog", FALSE);
-  _dbus_system_log (DBUS_SYSTEM_LOG_INFO, MESSAGE "%d", 42);
-  _dbus_system_log (DBUS_SYSTEM_LOG_WARNING, MESSAGE "%d", 45);
-  _dbus_system_log (DBUS_SYSTEM_LOG_SECURITY, MESSAGE "%d", 666);
+  _dbus_log (DBUS_SYSTEM_LOG_INFO, MESSAGE "%d", 42);
+  _dbus_log (DBUS_SYSTEM_LOG_WARNING, MESSAGE "%d", 45);
+  _dbus_log (DBUS_SYSTEM_LOG_SECURITY, MESSAGE "%d", 666);
 }
 
 static void