void ovs_abort(int err_no, const char *format, ...)
PRINTF_FORMAT(2, 3) NO_RETURN;
+void ovs_abort_valist(int err_no, const char *format, va_list)
+ PRINTF_FORMAT(2, 0) NO_RETURN;
void ovs_fatal(int err_no, const char *format, ...)
PRINTF_FORMAT(2, 3) NO_RETURN;
void ovs_fatal_valist(int err_no, const char *format, va_list)
va_end(args);
}
+/* Logs 'message' to 'module' at maximum verbosity, then exits with a failure
+ * exit code. Always writes the message to stderr, even if the console
+ * facility is disabled.
+ *
+ * Choose this function instead of vlog_abort_valist() if the daemon monitoring
+ * facility shouldn't automatically restart the current daemon. */
void
vlog_fatal_valist(const struct vlog_module *module_,
const char *message, va_list args)
ovs_fatal_valist(0, message, args);
}
+/* Logs 'message' to 'module' at maximum verbosity, then exits with a failure
+ * exit code. Always writes the message to stderr, even if the console
+ * facility is disabled.
+ *
+ * Choose this function instead of vlog_abort() if the daemon monitoring
+ * facility shouldn't automatically restart the current daemon. */
void
vlog_fatal(const struct vlog_module *module, const char *message, ...)
{
va_end(args);
}
+/* Logs 'message' to 'module' at maximum verbosity, then calls abort(). Always
+ * writes the message to stderr, even if the console facility is disabled.
+ *
+ * Choose this function instead of vlog_fatal_valist() if the daemon monitoring
+ * facility should automatically restart the current daemon. */
+void
+vlog_abort_valist(const struct vlog_module *module_,
+ const char *message, va_list args)
+{
+ struct vlog_module *module = (struct vlog_module *) module_;
+
+ /* Don't log this message to the console to avoid redundancy with the
+ * message written by the later ovs_abort_valist(). */
+ module->levels[VLF_CONSOLE] = VLL_OFF;
+
+ vlog_valist(module, VLL_EMER, message, args);
+ ovs_abort_valist(0, message, args);
+}
+
+/* Logs 'message' to 'module' at maximum verbosity, then calls abort(). Always
+ * writes the message to stderr, even if the console facility is disabled.
+ *
+ * Choose this function instead of vlog_fatal() if the daemon monitoring
+ * facility should automatically restart the current daemon. */
+void
+vlog_abort(const struct vlog_module *module, const char *message, ...)
+{
+ va_list args;
+
+ va_start(args, message);
+ vlog_abort_valist(module, message, args);
+ va_end(args);
+}
+
bool
vlog_should_drop(const struct vlog_module *module, enum vlog_level level,
struct vlog_rate_limit *rl)
void vlog_fatal_valist(const struct vlog_module *, const char *format, va_list)
PRINTF_FORMAT (2, 0) NO_RETURN;
+void vlog_abort(const struct vlog_module *, const char *format, ...)
+ PRINTF_FORMAT (2, 3) NO_RETURN;
+void vlog_abort_valist(const struct vlog_module *, const char *format, va_list)
+ PRINTF_FORMAT (2, 0) NO_RETURN;
+
void vlog_rate_limit(const struct vlog_module *, enum vlog_level,
struct vlog_rate_limit *, const char *, ...)
PRINTF_FORMAT (4, 5);
* Guaranteed to preserve errno.
*/
#define VLOG_FATAL(...) vlog_fatal(THIS_MODULE, __VA_ARGS__)
+#define VLOG_ABORT(...) vlog_abort(THIS_MODULE, __VA_ARGS__)
#define VLOG_EMER(...) VLOG(VLL_EMER, __VA_ARGS__)
#define VLOG_ERR(...) VLOG(VLL_ERR, __VA_ARGS__)
#define VLOG_WARN(...) VLOG(VLL_WARN, __VA_ARGS__)