[pan2] improve verbose output in non-gui mode
- From: Heinrich Müller <henmull src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2] improve verbose output in non-gui mode
- Date: Fri, 1 Mar 2013 17:13:07 +0000 (UTC)
commit 42b92920f7170e0e8a0cc969e830f6b81a450c06
Author: Heinrich Müller <henmull src gnome org>
Date: Thu Feb 28 20:51:37 2013 +0100
improve verbose output in non-gui mode
pan/general/debug.h | 6 +++---
pan/gui/pan.cc | 20 ++++++++++----------
pan/tasks/task-article.cc | 4 ----
pan/tasks/task-xover.cc | 3 +++
pan/tasks/task.cc | 1 +
5 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/pan/general/debug.h b/pan/general/debug.h
index 265658f..d1231d2 100644
--- a/pan/general/debug.h
+++ b/pan/general/debug.h
@@ -50,19 +50,19 @@ namespace pan
#define verbose(A) \
do { \
if (_verbose_flag) \
- std::cout << A << '\n'; \
+ std::cerr << A << '\n'; \
} while (0)
#define debug_SSL(A) \
do { \
if (_dbg_ssl) \
- std::cout << A << '\n'; \
+ std::cerr << A << '\n'; \
} while (0)
#define debug_SSL_verbatim(A) \
do { \
if (_dbg_ssl) \
- std::cout << A << '\n'; \
+ std::cerr << A << '\n'; \
} while (0)
#ifndef UNUSED
diff --git a/pan/gui/pan.cc b/pan/gui/pan.cc
index c63a6ec..e229e92 100644
--- a/pan/gui/pan.cc
+++ b/pan/gui/pan.cc
@@ -627,12 +627,9 @@ _("General Options\n"
"\n"
"URL Options\n"
-// Doesn't work yet.
-/*" news:message-id Show the specified article.\n"
+" news:message-id Show the specified article.\n"
" news:group.name Show the specified newsgroup.\n"
" headers:group.name Download new headers for the specified newsgroup.\n"
-*/
-
" --no-gui On news:message-id, dump the article to stdout.\n"
"\n"
"NZB Batch Options\n"
@@ -887,9 +884,9 @@ main (int argc, char *argv[])
textdomain (GETTEXT_PACKAGE);
g_type_init();
-#if !GLIB_CHECK_VERSION(2,32,0)
+//#if !GLIB_CHECK_VERSION(2,32,0)
g_thread_init (0);
-#endif
+//#endif
g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);
bool gui(true), nzb(false), verbosed(false);
@@ -898,6 +895,8 @@ main (int argc, char *argv[])
std::string nzb_output_path;
strings_v nzb_files;
std::string nzb_str;
+ bool fatal_dbg(true);
+ bool console_active(false);
for (int i=1; i<argc; ++i)
{
@@ -909,7 +908,7 @@ main (int argc, char *argv[])
else if (!strcmp(tok,"--no-gui") || !strcmp(tok,"--nogui"))
gui = false;
else if (!strcmp (tok, "--debug")) { // use --debug --debug for verbose debug
- console();
+ if (!console_active) { console_active = true; console(); }
if (_debug_flag) _debug_verbose_flag = true;
else _debug_flag = true;
} else if (!strcmp (tok, "--nzb"))
@@ -930,8 +929,10 @@ main (int argc, char *argv[])
else if (!strcmp(tok,"-h") || !strcmp(tok,"--help"))
{ usage (); return EXIT_SUCCESS; }
else if (!strcmp(tok, "--verbose") )
+ {
+ if (!console_active) { console_active = true; console(); }
verbosed = true;
- else {
+ } else {
nzb = true;
nzb_files.push_back (tok);
if (nzb_files.size() > 1) nzb_str +=" ";
@@ -943,10 +944,9 @@ main (int argc, char *argv[])
setlocale(LC_ALL,"C");
#endif
- if (verbosed && !gui && nzb)
+ if (verbosed && !gui)
_verbose_flag = true;
-
if (gui)
{
gtk_init (&argc, &argv);
diff --git a/pan/tasks/task-article.cc b/pan/tasks/task-article.cc
index 7989861..7be9f16 100644
--- a/pan/tasks/task-article.cc
+++ b/pan/tasks/task-article.cc
@@ -159,10 +159,6 @@ TaskArticle :: TaskArticle (const ServerRank & server_rank,
else
set_status_va (_("Saving %s"), artsub);
- char buf[2048];
- g_snprintf(buf,sizeof(buf), _("Saving %s"), artsub);
- verbose (buf);
-
update_work ();
}
diff --git a/pan/tasks/task-xover.cc b/pan/tasks/task-xover.cc
index 3bd1882..f941190 100644
--- a/pan/tasks/task-xover.cc
+++ b/pan/tasks/task-xover.cc
@@ -487,6 +487,9 @@ TaskXOver::update_work(bool subtract_one_from_nntp_count)
{
_state.set_completed();
set_finished(OK);
+ char str[4096];
+ g_snprintf(str, sizeof(str), _("Getting new headers for \"%s\" done."), _group.c_str());
+ verbose (str);
}
}
diff --git a/pan/tasks/task.cc b/pan/tasks/task.cc
index 0caa968..184dca2 100644
--- a/pan/tasks/task.cc
+++ b/pan/tasks/task.cc
@@ -26,6 +26,7 @@ using namespace pan;
Task :: Task (const Quark& type, const StringView& description): Progress(description), _type(type)
{
+ verbose (_description);
}
Task :: ~Task ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]