From 7467525c8d0f542e4dba82c788727bdb7d8ccfe0 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Thu, 13 Apr 2017 08:44:20 +0900 Subject: [PATCH] Add log_detail() method --- log.c | 16 +++++++++++++++- log.h | 2 ++ repmgr.c | 3 +-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/log.c b/log.c index 5d13ed81..b16676ac 100644 --- a/log.c +++ b/log.c @@ -71,7 +71,7 @@ _stderr_log_with_level(const char *level_name, int level, const char *fmt, va_li /* * Store the requested level so that if there's a subsequent - * log_hint(), we can suppress that if appropriate. + * log_hint() or log_detail(), we can suppress that if appropriate. */ last_log_level = level; @@ -113,6 +113,20 @@ log_hint(const char *fmt, ...) } +void +log_detail(const char *fmt, ...) +{ + va_list ap; + + if (terse_logging == false) + { + va_start(ap, fmt); + _stderr_log_with_level("DETAIL", last_log_level, fmt, ap); + va_end(ap); + } +} + + void log_verbose(int level, const char *fmt, ...) { diff --git a/log.h b/log.h index 10e4217e..ef16fb39 100644 --- a/log.h +++ b/log.h @@ -126,6 +126,8 @@ bool logger_shutdown(void); void logger_set_verbose(void); void logger_set_terse(void); +void log_detail(const char *fmt, ...) +__attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2))); void log_hint(const char *fmt, ...) __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2))); void log_verbose(int level, const char *fmt, ...) diff --git a/repmgr.c b/repmgr.c index 08897985..b3935760 100644 --- a/repmgr.c +++ b/repmgr.c @@ -220,7 +220,7 @@ main(int argc, char **argv) {"rsync-only", no_argument, NULL, 'r'}, {"fast-checkpoint", no_argument, NULL, 'c'}, {"log-level", required_argument, NULL, 'L'}, - {"terse", required_argument, NULL, 't'}, + {"terse", no_argument, NULL, 't'}, {"mode", required_argument, NULL, 'm'}, {"remote-config-file", required_argument, NULL, 'C'}, {"help", no_argument, NULL, OPT_HELP}, @@ -877,7 +877,6 @@ main(int argc, char **argv) if (runtime_options.terse) logger_set_terse(); - /* * Node configuration information is not needed for all actions, with * STANDBY CLONE being the main exception.