aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFLogger.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-06-18 15:40:41 +0200
committerJay Berkenbilt <ejb@ql.org>2022-06-18 15:54:40 +0200
commit83be2191b4f3eb8906160d61f61cae48532ee651 (patch)
treeedc4298b13dba0bdd501954489549725218c2373 /libqpdf/QPDFLogger.cc
parent641e92c6a7662a01f488947c3791f3b77e85517f (diff)
downloadqpdf-83be2191b4f3eb8906160d61f61cae48532ee651.tar.zst
Use "save" logger when saving data to standard output
This includes the output PDF, streams from --show-object and attachments from --save-attachment. This also enables --verbose and --progress to work with saving to stdout.
Diffstat (limited to 'libqpdf/QPDFLogger.cc')
-rw-r--r--libqpdf/QPDFLogger.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/libqpdf/QPDFLogger.cc b/libqpdf/QPDFLogger.cc
index 859d6dcd..3b25c050 100644
--- a/libqpdf/QPDFLogger.cc
+++ b/libqpdf/QPDFLogger.cc
@@ -2,6 +2,7 @@
#include <qpdf/Pl_Discard.hh>
#include <qpdf/Pl_OStream.hh>
+#include <qpdf/QUtil.hh>
#include <iostream>
#include <stdexcept>
@@ -182,6 +183,9 @@ QPDFLogger::setError(std::shared_ptr<Pipeline> p)
void
QPDFLogger::setSave(std::shared_ptr<Pipeline> p)
{
+ if (this->m->p_save == p) {
+ return;
+ }
if (p == this->m->p_stdout) {
auto pt = dynamic_cast<Pl_Track*>(p.get());
if (pt->getUsed()) {
@@ -192,6 +196,7 @@ QPDFLogger::setSave(std::shared_ptr<Pipeline> p)
if (this->m->p_info == this->m->p_stdout) {
this->m->p_info = this->m->p_stderr;
}
+ QUtil::binary_stdout();
}
this->m->p_save = p;
}