Add command line option to set the log level.

This commit is contained in:
Sebastian Ramacher 2012-03-23 19:28:20 +01:00
parent 22d750eb4e
commit 0c85d41c6c
2 changed files with 28 additions and 10 deletions

View File

@ -4,7 +4,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: zathura 0.1.1\n" "Project-Id-Version: zathura 0.1.1\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-03-20 00:55+0100\n" "POT-Creation-Date: 2012-03-23 19:24+0100\n"
"PO-Revision-Date: 2012-03-05 17:26+0100\n" "PO-Revision-Date: 2012-03-05 17:26+0100\n"
"Last-Translator: Sebastian Ramacher <s.ramacher@gmx.at>\n" "Last-Translator: Sebastian Ramacher <s.ramacher@gmx.at>\n"
"Language-Team: pwmt.org <mail@pwmt.org>\n" "Language-Team: pwmt.org <mail@pwmt.org>\n"
@ -176,7 +176,7 @@ msgstr "Zeige Ordner an"
#: ../config.c:120 #: ../config.c:120
msgid "Always open on first page" msgid "Always open on first page"
msgstr "" msgstr "Öffne Dokument immer auf der ersten Seite"
#. define default inputbar commands #. define default inputbar commands
#: ../config.c:240 #: ../config.c:240
@ -223,19 +223,23 @@ msgstr "Speichere Dokument (und überschreibe bestehende)"
msgid "Save attachments" msgid "Save attachments"
msgstr "Speichere Anhänge" msgstr "Speichere Anhänge"
#: ../document.c:373 ../document.c:397 ../document.c:416 ../document.c:438 #: ../document.c:439 ../document.c:463 ../document.c:482 ../document.c:504
#: ../document.c:457 ../document.c:479 ../document.c:498 ../document.c:541 #: ../document.c:523 ../document.c:545 ../document.c:564 ../document.c:607
#: ../document.c:561 ../document.c:584 ../document.c:613 ../document.c:642 #: ../document.c:627 ../document.c:650 ../document.c:679 ../document.c:708
#: ../document.c:666 ../document.c:687 ../document.c:708 #: ../document.c:732 ../document.c:753 ../document.c:774
#, c-format #, c-format
msgid "%s not implemented" msgid "%s not implemented"
msgstr "%s ist nicht implementiert." msgstr "%s ist nicht implementiert."
#: ../page-widget.c:555 #: ../page-widget.c:570
#, c-format #, c-format
msgid "Copied selected text to clipbard: %s" msgid "Copied selected text to clipbard: %s"
msgstr "Der gewählte Text wurde in die Zwischenablage kopiert: %s" msgstr "Der gewählte Text wurde in die Zwischenablage kopiert: %s"
#: ../page-widget.c:662
msgid "Copy image"
msgstr "Bild kopieren"
#: ../shortcuts.c:726 #: ../shortcuts.c:726
msgid "This document does not contain any index" msgid "This document does not contain any index"
msgstr "Dieses Dokument beinhaltet kein Inhaltsverzeichnis." msgstr "Dieses Dokument beinhaltet kein Inhaltsverzeichnis."
@ -260,6 +264,10 @@ msgstr "Pfad zum Pluginverzeichnis"
msgid "Fork into the background" msgid "Fork into the background"
msgstr "Forkt den Prozess in den Hintergrund" msgstr "Forkt den Prozess in den Hintergrund"
#: ../zathura.c:225 ../zathura.c:600 #: ../zathura.c:60
msgid "Log level (debug, info, warning, error)"
msgstr ""
#: ../zathura.c:226 ../zathura.c:601
msgid "[No name]" msgid "[No name]"
msgstr "" msgstr ""

View File

@ -48,7 +48,7 @@ zathura_init(int argc, char* argv[])
Window embed = 0; Window embed = 0;
#endif #endif
gchar* config_dir = NULL, *data_dir = NULL, *plugin_path = NULL; gchar* config_dir = NULL, *data_dir = NULL, *plugin_path = NULL, *loglevel = NULL;
bool forkback = false; bool forkback = false;
GOptionEntry entries[] = GOptionEntry entries[] =
{ {
@ -56,7 +56,8 @@ zathura_init(int argc, char* argv[])
{ "config-dir", 'c', 0, G_OPTION_ARG_FILENAME, &config_dir, _("Path to the config directory"), "path" }, { "config-dir", 'c', 0, G_OPTION_ARG_FILENAME, &config_dir, _("Path to the config directory"), "path" },
{ "data-dir", 'd', 0, G_OPTION_ARG_FILENAME, &data_dir, _("Path to the data directory"), "path" }, { "data-dir", 'd', 0, G_OPTION_ARG_FILENAME, &data_dir, _("Path to the data directory"), "path" },
{ "plugins-dir", 'p', 0, G_OPTION_ARG_STRING, &plugin_path, _("Path to the directories containing plugins"), "path" }, { "plugins-dir", 'p', 0, G_OPTION_ARG_STRING, &plugin_path, _("Path to the directories containing plugins"), "path" },
{ "fork", '\0', 0, G_OPTION_ARG_NONE, &forkback, _("Fork into the background") , NULL }, { "fork", '\0', 0, G_OPTION_ARG_NONE, &forkback, _("Fork into the background"), NULL },
{ "debug", 'l', 0, G_OPTION_ARG_STRING, &loglevel, _("Log level (debug, info, warning, error)") "level" },
{ NULL, '\0', 0, 0, NULL, NULL, NULL } { NULL, '\0', 0, 0, NULL, NULL, NULL }
}; };
@ -86,6 +87,15 @@ zathura_init(int argc, char* argv[])
setsid(); setsid();
} }
/* Set log level. */
if (loglevel == NULL || g_strcmp0(loglevel, "info") == 0) {
girara_set_debug_level(GIRARA_INFO);
} else if (g_strcmp0(loglevel, "warning") == 0) {
girara_set_debug_level(GIRARA_WARNING);
} else if (g_strcmp0(loglevel, "error") == 0) {
girara_set_debug_level(GIRARA_ERROR);
}
zathura_t* zathura = g_malloc0(sizeof(zathura_t)); zathura_t* zathura = g_malloc0(sizeof(zathura_t));
/* plugins */ /* plugins */