diff options
Diffstat (limited to 'src/bin/scripts/createdb.c')
-rw-r--r-- | src/bin/scripts/createdb.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/bin/scripts/createdb.c b/src/bin/scripts/createdb.c index b40eea4365e..e4b497859b5 100644 --- a/src/bin/scripts/createdb.c +++ b/src/bin/scripts/createdb.c @@ -12,6 +12,7 @@ #include "postgres_fe.h" #include "common.h" +#include "fe_utils/logging.h" #include "fe_utils/string_utils.h" @@ -64,6 +65,7 @@ main(int argc, char *argv[]) PGconn *conn; PGresult *result; + pg_logging_init(argv[0]); progname = get_progname(argv[0]); set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pgscripts")); @@ -133,8 +135,8 @@ main(int argc, char *argv[]) comment = argv[optind + 1]; break; default: - fprintf(stderr, _("%s: too many command-line arguments (first is \"%s\")\n"), - progname, argv[optind + 2]); + pg_log_error("too many command-line arguments (first is \"%s\")", + argv[optind + 2]); fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname); exit(1); } @@ -143,14 +145,12 @@ main(int argc, char *argv[]) { if (lc_ctype) { - fprintf(stderr, _("%s: only one of --locale and --lc-ctype can be specified\n"), - progname); + pg_log_error("only one of --locale and --lc-ctype can be specified"); exit(1); } if (lc_collate) { - fprintf(stderr, _("%s: only one of --locale and --lc-collate can be specified\n"), - progname); + pg_log_error("only one of --locale and --lc-collate can be specified"); exit(1); } lc_ctype = locale; @@ -161,8 +161,7 @@ main(int argc, char *argv[]) { if (pg_char_to_encoding(encoding) < 0) { - fprintf(stderr, _("%s: \"%s\" is not a valid encoding name\n"), - progname, encoding); + pg_log_error("\"%s\" is not a valid encoding name", encoding); exit(1); } } @@ -210,8 +209,7 @@ main(int argc, char *argv[]) if (PQresultStatus(result) != PGRES_COMMAND_OK) { - fprintf(stderr, _("%s: database creation failed: %s"), - progname, PQerrorMessage(conn)); + pg_log_error("database creation failed: %s", PQerrorMessage(conn)); PQfinish(conn); exit(1); } @@ -230,8 +228,8 @@ main(int argc, char *argv[]) if (PQresultStatus(result) != PGRES_COMMAND_OK) { - fprintf(stderr, _("%s: comment creation failed (database was created): %s"), - progname, PQerrorMessage(conn)); + pg_log_error("comment creation failed (database was created): %s", + PQerrorMessage(conn)); PQfinish(conn); exit(1); } |