From 718053fa36398c9a33153a6221216bab034f88a0 Mon Sep 17 00:00:00 2001 From: Peter De Wachter Date: Mon, 30 Oct 2017 20:07:27 +0100 Subject: [PATCH] Add package name to all log messages --- src/debug.cc | 9 +++++---- src/main.cc | 12 ++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/debug.cc b/src/debug.cc index ee3c193..041b414 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -15,6 +15,7 @@ // You should have received a copy of the GNU General Public License // along with brlaser. If not, see . +#include "config.h" #include "debug.h" #include #include @@ -23,12 +24,12 @@ namespace { template void dump(const char *name, const T &value) { - std::cerr << "DEBUG: page header: " << name << " = " << value << '\n'; + std::cerr << "DEBUG: " PACKAGE ": page header: " << name << " = " << value << '\n'; } template void dump(const char *name, const T (&value)[N]) { - std::cerr << "DEBUG: page header: " << name << " ="; + std::cerr << "DEBUG: " PACKAGE ": page header: " << name << " ="; for (int i = 0; i < N; ++i) { std::cerr << ' ' << value[i]; } @@ -36,12 +37,12 @@ void dump(const char *name, const T (&value)[N]) { } void dump(const char *name, const char *value) { - std::cerr << "DEBUG: page header: " << name << " = \"" << value << "\"\n"; + std::cerr << "DEBUG: " PACKAGE ": page header: " << name << " = \"" << value << "\"\n"; } template void dump(const char *name, const char (&value)[N][M]) { - std::cerr << "DEBUG: page header: " << name << " ="; + std::cerr << "DEBUG: " PACKAGE ": page header: " << name << " ="; for (int i = 0; i < N; ++i) { std::cerr << " \"" << value[i] << '"'; } diff --git a/src/main.cc b/src/main.cc index a185dec..7705168 100644 --- a/src/main.cc +++ b/src/main.cc @@ -151,14 +151,14 @@ int main(int argc, char *argv[]) { if (job_filename) { fd = open(job_filename, O_RDONLY); if (fd < 0) { - fprintf(stderr, "ERROR: Unable to open raster file\n"); + fprintf(stderr, "ERROR: " PACKAGE ": Unable to open raster file\n"); return 1; } } ras = cupsRasterOpen(fd, CUPS_RASTER_READ); if (!ras) { - fprintf(stderr, "ERROR: Can't read raster data\n"); + fprintf(stderr, "ERROR: " PACKAGE ": Can't read raster data\n"); return 1; } @@ -170,12 +170,12 @@ int main(int argc, char *argv[]) { || header.cupsBitsPerColor != 1 || header.cupsNumColors != 1 || header.cupsBytesPerLine > 10000) { - fprintf(stderr, "ERROR: Page %d: Bogus raster data.\n", pages + 1); + fprintf(stderr, "ERROR: " PACKAGE ": Page %d: Bogus raster data.\n", pages + 1); dump_page_header(header); return 1; } if (pages == 0) { - fprintf(stderr, "DEBUG: Page header of first page\n"); + fprintf(stderr, "DEBUG: " PACKAGE ": Page header of first page\n"); dump_page_header(header); } job.encode_page(build_page_params(), @@ -187,13 +187,13 @@ int main(int argc, char *argv[]) { } if (pages == 0) { - fprintf(stderr, "ERROR: No pages were found.\n"); + fprintf(stderr, "ERROR: " PACKAGE ": No pages were found.\n"); return 1; } fflush(stdout); if (ferror(stdout)) { - fprintf(stderr, "ERROR: Could not write print data\n"); + fprintf(stderr, "ERROR: " PACKAGE ": Could not write print data\n"); return 1; } return 0;