[gimp] plug-ins: Hide darktable debug output
- From: Tobias Ellinghaus <et src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: Hide darktable debug output
- Date: Mon, 20 Nov 2017 11:50:15 +0000 (UTC)
commit c10c640451fc232b2e57397c4257dc81be8bd42c
Author: Tobias Ellinghaus <me houz org>
Date: Mon Nov 20 12:48:47 2017 +0100
plug-ins: Hide darktable debug output
Only show debugging messages from the darktable raw loader when the
environment variable DARKTABLE_DEBUG is set.
plug-ins/file-raw/file-darktable.c | 32 +++++++++++++++++++++-----------
1 files changed, 21 insertions(+), 11 deletions(-)
---
diff --git a/plug-ins/file-raw/file-darktable.c b/plug-ins/file-raw/file-darktable.c
index d8bb252..e8ac2a5 100644
--- a/plug-ins/file-raw/file-darktable.c
+++ b/plug-ins/file-raw/file-darktable.c
@@ -107,7 +107,11 @@ init (void)
GError *error = NULL;
gint i;
- printf ("[%s] trying to call '%s'\n", __FILE__, exec_path);
+ /* allow the user to have some insight into why darktable may fail. */
+ gboolean debug_prints = g_getenv ("DARKTABLE_DEBUG") != NULL;
+
+ if (debug_prints)
+ printf ("[%s] trying to call '%s'\n", __FILE__, exec_path);
if (g_spawn_sync (NULL,
argv,
@@ -136,20 +140,22 @@ init (void)
}
}
}
- else
+ else if (debug_prints)
printf ("[%s] g_spawn_sync failed\n", __FILE__);
- if (error)
+ if (debug_prints)
{
- printf ("[%s] error: %s\n", __FILE__, error->message);
- g_error_free (error);
+ if (error)
+ printf ("[%s] error: %s\n", __FILE__, error->message);
+ if (darktable_stdout && *darktable_stdout)
+ printf ("[%s] stdout:\n%s\n", __FILE__, darktable_stdout);
+ if (darktable_stderr && *darktable_stderr)
+ printf ("[%s] stderr:\n%s\n", __FILE__, darktable_stderr);
+ printf ("[%s] have_darktable: %d\n", __FILE__, have_darktable);
}
- if (darktable_stdout && *darktable_stdout)
- printf ("[%s] stdout:\n%s\n", __FILE__, darktable_stdout);
- if (darktable_stderr && *darktable_stderr)
- printf ("[%s] stderr:\n%s\n", __FILE__, darktable_stderr);
- printf ("[%s] have_darktable: %d\n", __FILE__, have_darktable);
+ if (error)
+ g_error_free (error);
g_free (darktable_stdout);
g_free (darktable_stderr);
g_free (exec_path);
@@ -337,6 +343,9 @@ load_image (const gchar *filename,
gchar *darktable_stdout = NULL;
+ /* allow the user to have some insight into why darktable may fail. */
+ gboolean debug_prints = g_getenv ("DARKTABLE_DEBUG") != NULL;
+
/* linear sRGB for now as GIMP uses that internally in many places anyway */
gboolean search_path = FALSE;
gchar *exec_path = file_raw_get_executable_path ("darktable", NULL,
@@ -381,7 +390,8 @@ load_image (const gchar *filename,
gimp_image_set_filename (image_ID, filename);
}
- /*if (darktable_stdout) printf ("%s\n", darktable_stdout);*/
+ if (debug_prints && darktable_stdout && *darktable_stdout)
+ printf ("%s\n", darktable_stdout);
g_free(darktable_stdout);
g_unlink (filename_out);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]