mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-10 09:07:02 +02:00
MINOR: errors: ha_alert() and ha_warning() uses warn_exec_path()
Move the code to display the haproxy version and path during starting mode, which is called by the first ha_alert() or ha_warning().
This commit is contained in:
parent
78021ee9ef
commit
b959b752f9
34
src/errors.c
34
src/errors.c
@ -420,6 +420,22 @@ static void print_message_args(int use_usermsgs_ctx, const char *label, const ch
|
|||||||
va_end(argp);
|
va_end(argp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Display a notice with the happroxy version and executable path when the
|
||||||
|
* first message is emitted in starting mode.
|
||||||
|
*/
|
||||||
|
static void warn_exec_path()
|
||||||
|
{
|
||||||
|
if (!(warned & WARN_EXEC_PATH) && (global.mode & MODE_STARTING)) {
|
||||||
|
const char *path = get_exec_path();
|
||||||
|
|
||||||
|
warned |= WARN_EXEC_PATH;
|
||||||
|
print_message_args(0, "NOTICE", "haproxy version is %s\n", haproxy_version);
|
||||||
|
if (path)
|
||||||
|
print_message_args(0, "NOTICE", "path to executable is %s\n", path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Displays the message on stderr with the pid. Overrides the quiet
|
* Displays the message on stderr with the pid. Overrides the quiet
|
||||||
* mode during startup.
|
* mode during startup.
|
||||||
@ -430,14 +446,7 @@ void ha_alert(const char *fmt, ...)
|
|||||||
|
|
||||||
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE) ||
|
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE) ||
|
||||||
!(global.mode & MODE_STARTING)) {
|
!(global.mode & MODE_STARTING)) {
|
||||||
if (!(warned & WARN_EXEC_PATH) && (global.mode & MODE_STARTING)) {
|
warn_exec_path();
|
||||||
const char *path = get_exec_path();
|
|
||||||
|
|
||||||
warned |= WARN_EXEC_PATH;
|
|
||||||
print_message_args(0, "NOTICE", "haproxy version is %s\n", haproxy_version);
|
|
||||||
if (path)
|
|
||||||
print_message_args(0, "NOTICE", "path to executable is %s\n", path);
|
|
||||||
}
|
|
||||||
va_start(argp, fmt);
|
va_start(argp, fmt);
|
||||||
print_message(1, "ALERT", fmt, argp);
|
print_message(1, "ALERT", fmt, argp);
|
||||||
va_end(argp);
|
va_end(argp);
|
||||||
@ -456,14 +465,7 @@ void ha_warning(const char *fmt, ...)
|
|||||||
|
|
||||||
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE) ||
|
if (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE) ||
|
||||||
!(global.mode & MODE_STARTING)) {
|
!(global.mode & MODE_STARTING)) {
|
||||||
if (!(warned & WARN_EXEC_PATH) && (global.mode & MODE_STARTING)) {
|
warn_exec_path();
|
||||||
const char *path = get_exec_path();
|
|
||||||
|
|
||||||
warned |= WARN_EXEC_PATH;
|
|
||||||
print_message_args(0, "NOTICE", "haproxy version is %s\n", haproxy_version);
|
|
||||||
if (path)
|
|
||||||
print_message_args(0, "NOTICE", "path to executable is %s\n", path);
|
|
||||||
}
|
|
||||||
va_start(argp, fmt);
|
va_start(argp, fmt);
|
||||||
print_message(1, "WARNING", fmt, argp);
|
print_message(1, "WARNING", fmt, argp);
|
||||||
va_end(argp);
|
va_end(argp);
|
||||||
|
Loading…
Reference in New Issue
Block a user