1
0
mirror of https://github.com/pdewacht/brlaser synced 2025-04-05 12:36:43 +02:00

Add package name to all log messages

This commit is contained in:
Peter De Wachter 2017-10-30 20:07:27 +01:00
parent 931c677443
commit 718053fa36
2 changed files with 11 additions and 10 deletions

View File

@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License
// along with brlaser. If not, see <http://www.gnu.org/licenses/>.
#include "config.h"
#include "debug.h"
#include <iostream>
#include <typeinfo>
@ -23,12 +24,12 @@ namespace {
template <typename T>
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 <typename T, int N>
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 <int N, int M>
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] << '"';
}

View File

@ -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;