Make it possible to debug filters on stdout
Two changes being done: a) special value 'stdout', or an empty string, for 'filters-log-file' will make logging into stdout b) running with CAMEL_DEBUG=filters also turns on logging to stdout. The output file from GSettings has precedence over the stdout used by CAMEL_DEBUG, when both loggings are enabled. In other words, in case GSettings has enabled logging, then GSettings dictate which file is used for the log, otherwise GSettings values are ignored and stdout is used only when CAMEL_DEBUG logging is enabled.
This commit is contained in:
@ -426,7 +426,7 @@
|
||||
<key name="filters-log-file" type="s">
|
||||
<default>''</default>
|
||||
<_summary>Logfile to log filter actions</_summary>
|
||||
<_description>Logfile to log filter actions.</_description>
|
||||
<_description>If not set, or being 'stdout', then the logging is done to stdout, instead to a file.</_description>
|
||||
</key>
|
||||
<key name="flush-outbox" type="b">
|
||||
<default>false</default>
|
||||
|
||||
@ -251,15 +251,23 @@ main_get_filter_driver (CamelSession *session,
|
||||
driver = camel_filter_driver_new (session);
|
||||
camel_filter_driver_set_folder_func (driver, get_folder, session);
|
||||
|
||||
if (g_settings_get_boolean (settings, "filters-log-actions")) {
|
||||
if (priv->filter_logfile == NULL) {
|
||||
if (g_settings_get_boolean (settings, "filters-log-actions") ||
|
||||
camel_debug ("filters")) {
|
||||
if (!priv->filter_logfile &&
|
||||
g_settings_get_boolean (settings, "filters-log-actions")) {
|
||||
gchar *filename;
|
||||
|
||||
filename = g_settings_get_string (settings, "filters-log-file");
|
||||
if (filename) {
|
||||
priv->filter_logfile = g_fopen (filename, "a+");
|
||||
if (!*filename || g_strcmp0 (filename, "stdout") == 0)
|
||||
priv->filter_logfile = stdout;
|
||||
else
|
||||
priv->filter_logfile = g_fopen (filename, "a+");
|
||||
|
||||
g_free (filename);
|
||||
}
|
||||
} else if (!priv->filter_logfile) {
|
||||
priv->filter_logfile = stdout;
|
||||
}
|
||||
|
||||
if (priv->filter_logfile)
|
||||
|
||||
Reference in New Issue
Block a user