}
#endif
+static void
+midori_log_to_file (const gchar* log_domain,
+ GLogLevelFlags log_level,
+ const gchar* message,
+ gpointer user_data)
+{
+ FILE* logfile = fopen ((const char*)user_data, "a");
+ gchar* level_name = "";
+
+ switch (log_level)
+ {
+ /* skip irrelevant flags */
+ case G_LOG_LEVEL_MASK:
+ case G_LOG_FLAG_FATAL:
+ case G_LOG_FLAG_RECURSION:
+
+ case G_LOG_LEVEL_ERROR:
+ level_name = "ERROR";
+ break;
+ case G_LOG_LEVEL_CRITICAL:
+ level_name = "CRITICAL";
+ break;
+ case G_LOG_LEVEL_WARNING:
+ level_name = "WARNING";
+ break;
+ case G_LOG_LEVEL_MESSAGE:
+ level_name = "MESSAGE";
+ break;
+ case G_LOG_LEVEL_INFO:
+ level_name = "INFO";
+ break;
+ case G_LOG_LEVEL_DEBUG:
+ level_name = "DEBUG";
+ break;
+ }
+
+ fprintf (logfile, "%s %s: %s\n",
+ log_domain ? log_domain : "Midori", level_name, message);
+ fclose (logfile);
+}
+
int
main (int argc,
char** argv)
gboolean back_from_crash;
gboolean run;
gchar* snapshot;
+ gchar* logfile;
gboolean execute;
gboolean help_execute;
gboolean version;
/* i18n: CLI: Close tabs, clear private data, open starting page */
N_("Reset Midori after SECONDS seconds of inactivity"), N_("SECONDS") },
#endif
+ { "log-file", 'l', 0, G_OPTION_ARG_FILENAME, &logfile,
+ N_("Redirects console warnings to the specified FILENAME"), N_("FILENAME")},
{ NULL }
};
GString* error_messages;
diagnostic_dialog = FALSE;
run = FALSE;
snapshot = NULL;
+ logfile = NULL;
execute = FALSE;
help_execute = FALSE;
version = FALSE;
}
#endif
+ if (logfile)
+ {
+ g_log_set_default_handler (midori_log_to_file, (gpointer)logfile);
+ }
+
sokoke_register_privacy_item ("page-icons", _("Website icons"),
G_CALLBACK (midori_clear_page_icons_cb));
/* i18n: Logins and passwords in websites and web forms */