X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=inline;f=lib%2Fvlog.c;h=d4d277aadd6bb23efa746df8eccb53b8392ce1e5;hb=d41d4b714d29091dd502dd8705ef489467e11a43;hp=128ed45dcf5b46b6bb6ba6aa650ea5df3f556065;hpb=e8087a87a3155656596d92ebecfa37841b637ef7;p=sliver-openvswitch.git diff --git a/lib/vlog.c b/lib/vlog.c index 128ed45dc..d4d277aad 100644 --- a/lib/vlog.c +++ b/lib/vlog.c @@ -745,6 +745,12 @@ vlog(const struct vlog_module *module, enum vlog_level level, 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) @@ -759,6 +765,12 @@ vlog_fatal_valist(const struct vlog_module *module_, 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, ...) { @@ -769,6 +781,40 @@ 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)