*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
*/
#ifdef HAVE_CONFIG_H
#include "defs.h"
+#ifdef G_OS_WIN32
+# include <w32lib.h>
+#endif
+
#include <stdio.h>
#include <glib.h>
#include <glib/gi18n.h>
{ DEBUG_FILTERING_APPEND_TEXT_HOOKLIST, NULL, NULL, NULL }
};
+gboolean prefs_common_enable_log_standard(void);
+gboolean prefs_common_enable_log_warning(void);
+gboolean prefs_common_enable_log_error(void);
+gboolean prefs_common_enable_log_status(void);
+
static gboolean invoke_hook_cb (gpointer data)
{
LogText *logtext = (LogText *)data;
g_vsnprintf(buf + LOG_TIME_LEN, BUFFSIZE, format, args);
va_end(args);
- if (debug_get_mode()) fputs(buf, stdout);
+ if (debug_get_mode()) g_printf(buf);
logtext->instance = instance;
logtext->text = g_strdup(buf);
logtext->type = LOG_NORMAL;
g_timeout_add(0, invoke_hook_cb, logtext);
-
- if (log_fp[instance]) {
+
+ if (log_fp[instance] && prefs_common_enable_log_standard()) {
fputs(buf, log_fp[instance]);
fflush(log_fp[instance]);
}
g_timeout_add(0, invoke_hook_cb, logtext);
- if (log_fp[instance]) {
+ if (log_fp[instance] && prefs_common_enable_log_standard()) {
fwrite(buf, 1, LOG_TIME_LEN, log_fp[instance]);
fputs("* message: ", log_fp[instance]);
fputs(buf + LOG_TIME_LEN, log_fp[instance]);
g_timeout_add(0, invoke_hook_cb, logtext);
- if (log_fp[instance]) {
+ if (log_fp[instance] && prefs_common_enable_log_warning()) {
fwrite(buf, 1, LOG_TIME_LEN, log_fp[instance]);
fputs("** warning: ", log_fp[instance]);
fputs(buf + LOG_TIME_LEN, log_fp[instance]);
g_timeout_add(0, invoke_hook_cb, logtext);
- if (log_fp[instance]) {
+ if (log_fp[instance] && prefs_common_enable_log_error()) {
fwrite(buf, 1, LOG_TIME_LEN, log_fp[instance]);
fputs("*** error: ", log_fp[instance]);
fputs(buf + LOG_TIME_LEN, log_fp[instance]);
g_timeout_add(0, invoke_hook_cb, logtext);
- if (log_fp[instance]) {
+ if (log_fp[instance] && prefs_common_enable_log_status()) {
fwrite(buf, 1, LOG_TIME_LEN, log_fp[instance]);
fputs("* OK: ", log_fp[instance]);
fputs(buf + LOG_TIME_LEN, log_fp[instance]);
g_timeout_add(0, invoke_hook_cb, logtext);
- if (log_fp[instance]) {
+ if (log_fp[instance] && prefs_common_enable_log_status()) {
fwrite(buf, 1, LOG_TIME_LEN, log_fp[instance]);
fputs("* NOT OK: ", log_fp[instance]);
fputs(buf + LOG_TIME_LEN, log_fp[instance]);
g_timeout_add(0, invoke_hook_cb, logtext);
- if (log_fp[instance]) {
+ if (log_fp[instance] && prefs_common_enable_log_status()) {
fwrite(buf, 1, LOG_TIME_LEN, log_fp[instance]);
fputs("* SKIPPED: ", log_fp[instance]);
fputs(buf + LOG_TIME_LEN, log_fp[instance]);