diff options
-rw-r--r-- | doc/de/autogen/logger_options.xml | 104 | ||||
-rw-r--r-- | doc/en/autogen/logger_options.xml | 104 | ||||
-rw-r--r-- | doc/fr/autogen/logger_options.xml | 104 | ||||
-rw-r--r-- | doc/include_autogen.xml | 1 | ||||
-rw-r--r-- | po/POTFILES.in | 2 | ||||
-rw-r--r-- | po/cs.po | 33 | ||||
-rw-r--r-- | po/de.po | 33 | ||||
-rw-r--r-- | po/es.po | 34 | ||||
-rw-r--r-- | po/fr.po | 41 | ||||
-rw-r--r-- | po/hu.po | 34 | ||||
-rw-r--r-- | po/ru.po | 33 | ||||
-rw-r--r-- | po/srcfiles.cmake | 2 | ||||
-rw-r--r-- | po/weechat.pot | 29 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.c | 10 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.h | 1 | ||||
-rw-r--r-- | src/plugins/irc/irc.c | 4 | ||||
-rw-r--r-- | src/plugins/logger/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/plugins/logger/Makefile.am | 2 | ||||
-rw-r--r-- | src/plugins/logger/logger-config.c | 150 | ||||
-rw-r--r-- | src/plugins/logger/logger-config.h | 41 | ||||
-rw-r--r-- | src/plugins/logger/logger.c | 193 |
21 files changed, 793 insertions, 163 deletions
diff --git a/doc/de/autogen/logger_options.xml b/doc/de/autogen/logger_options.xml new file mode 100644 index 000000000..ca769bab8 --- /dev/null +++ b/doc/de/autogen/logger_options.xml @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ********* WARNING! ********* + + This file is autogenerated with docgen.pl script. *** DO NOT EDIT! *** + docgen.pl builds XML doc files to include in many languages +--> + +<command>logger.file.auto_log</command> +<itemizedlist> + <listitem> + <para>description: automatically save content of buffers to files (unless a buffer disables log)</para> + </listitem> + <listitem> + <para>type: boolean</para> + </listitem> + <listitem> + <para>values: on, off</para> + </listitem> + <listitem> + <para>default value: on</para> + </listitem> +</itemizedlist> + +<command>logger.file.info_lines</command> +<itemizedlist> + <listitem> + <para>description: write information line in log file when log starts or ends for a buffer</para> + </listitem> + <listitem> + <para>type: boolean</para> + </listitem> + <listitem> + <para>values: on, off</para> + </listitem> + <listitem> + <para>default value: off</para> + </listitem> +</itemizedlist> + +<command>logger.file.name_lower_case</command> +<itemizedlist> + <listitem> + <para>description: use only lower case for log filenames</para> + </listitem> + <listitem> + <para>type: boolean</para> + </listitem> + <listitem> + <para>values: on, off</para> + </listitem> + <listitem> + <para>default value: on</para> + </listitem> +</itemizedlist> + +<command>logger.file.path</command> +<itemizedlist> + <listitem> + <para>description: path for WeeChat log files ('%h' will be replaced by WeeChat home, ~/.weechat by default)</para> + </listitem> + <listitem> + <para>type: string</para> + </listitem> + <listitem> + <para>values: any string</para> + </listitem> + <listitem> + <para>default value: '%h/logs/'</para> + </listitem> +</itemizedlist> + +<command>logger.file.time_format</command> +<itemizedlist> + <listitem> + <para>description: timestamp used in log files (see man strftime for date/time specifiers)</para> + </listitem> + <listitem> + <para>type: string</para> + </listitem> + <listitem> + <para>values: any string</para> + </listitem> + <listitem> + <para>default value: '%Y-%m-%d %H:%M:%S'</para> + </listitem> +</itemizedlist> + +<command>logger.look.backlog</command> +<itemizedlist> + <listitem> + <para>description: maximum number of lines to display from log file when creating new buffer (0 = no backlog)</para> + </listitem> + <listitem> + <para>type: integer</para> + </listitem> + <listitem> + <para>values: 0 .. 2147483647</para> + </listitem> + <listitem> + <para>default value: 20</para> + </listitem> +</itemizedlist> + diff --git a/doc/en/autogen/logger_options.xml b/doc/en/autogen/logger_options.xml new file mode 100644 index 000000000..ca769bab8 --- /dev/null +++ b/doc/en/autogen/logger_options.xml @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ********* WARNING! ********* + + This file is autogenerated with docgen.pl script. *** DO NOT EDIT! *** + docgen.pl builds XML doc files to include in many languages +--> + +<command>logger.file.auto_log</command> +<itemizedlist> + <listitem> + <para>description: automatically save content of buffers to files (unless a buffer disables log)</para> + </listitem> + <listitem> + <para>type: boolean</para> + </listitem> + <listitem> + <para>values: on, off</para> + </listitem> + <listitem> + <para>default value: on</para> + </listitem> +</itemizedlist> + +<command>logger.file.info_lines</command> +<itemizedlist> + <listitem> + <para>description: write information line in log file when log starts or ends for a buffer</para> + </listitem> + <listitem> + <para>type: boolean</para> + </listitem> + <listitem> + <para>values: on, off</para> + </listitem> + <listitem> + <para>default value: off</para> + </listitem> +</itemizedlist> + +<command>logger.file.name_lower_case</command> +<itemizedlist> + <listitem> + <para>description: use only lower case for log filenames</para> + </listitem> + <listitem> + <para>type: boolean</para> + </listitem> + <listitem> + <para>values: on, off</para> + </listitem> + <listitem> + <para>default value: on</para> + </listitem> +</itemizedlist> + +<command>logger.file.path</command> +<itemizedlist> + <listitem> + <para>description: path for WeeChat log files ('%h' will be replaced by WeeChat home, ~/.weechat by default)</para> + </listitem> + <listitem> + <para>type: string</para> + </listitem> + <listitem> + <para>values: any string</para> + </listitem> + <listitem> + <para>default value: '%h/logs/'</para> + </listitem> +</itemizedlist> + +<command>logger.file.time_format</command> +<itemizedlist> + <listitem> + <para>description: timestamp used in log files (see man strftime for date/time specifiers)</para> + </listitem> + <listitem> + <para>type: string</para> + </listitem> + <listitem> + <para>values: any string</para> + </listitem> + <listitem> + <para>default value: '%Y-%m-%d %H:%M:%S'</para> + </listitem> +</itemizedlist> + +<command>logger.look.backlog</command> +<itemizedlist> + <listitem> + <para>description: maximum number of lines to display from log file when creating new buffer (0 = no backlog)</para> + </listitem> + <listitem> + <para>type: integer</para> + </listitem> + <listitem> + <para>values: 0 .. 2147483647</para> + </listitem> + <listitem> + <para>default value: 20</para> + </listitem> +</itemizedlist> + diff --git a/doc/fr/autogen/logger_options.xml b/doc/fr/autogen/logger_options.xml new file mode 100644 index 000000000..c79b471e2 --- /dev/null +++ b/doc/fr/autogen/logger_options.xml @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ********* WARNING! ********* + + This file is autogenerated with docgen.pl script. *** DO NOT EDIT! *** + docgen.pl builds XML doc files to include in many languages +--> + +<command>logger.file.auto_log</command> +<itemizedlist> + <listitem> + <para>description: sauve automatiquement le contenu des tampons dans des fichiers (sauf si un tampon désactive le log)</para> + </listitem> + <listitem> + <para>type: booléen</para> + </listitem> + <listitem> + <para>valeurs: on, off</para> + </listitem> + <listitem> + <para>valeur par défaut: on</para> + </listitem> +</itemizedlist> + +<command>logger.file.info_lines</command> +<itemizedlist> + <listitem> + <para>description: écrire une ligne d'information dans le fichier log quand le log démarre ou se termine pour un tampon</para> + </listitem> + <listitem> + <para>type: booléen</para> + </listitem> + <listitem> + <para>valeurs: on, off</para> + </listitem> + <listitem> + <para>valeur par défaut: off</para> + </listitem> +</itemizedlist> + +<command>logger.file.name_lower_case</command> +<itemizedlist> + <listitem> + <para>description: utiliser seulement des minuscules dans le nom des fichiers de log</para> + </listitem> + <listitem> + <para>type: booléen</para> + </listitem> + <listitem> + <para>valeurs: on, off</para> + </listitem> + <listitem> + <para>valeur par défaut: on</para> + </listitem> +</itemizedlist> + +<command>logger.file.path</command> +<itemizedlist> + <listitem> + <para>description: chemin pour les fichiers de log WeeChat ('%h' sera remplacé par le répertoire de base WeeChat, par défaut: ~/.weechat)</para> + </listitem> + <listitem> + <para>type: chaîne</para> + </listitem> + <listitem> + <para>valeurs: toute chaîne</para> + </listitem> + <listitem> + <para>valeur par défaut: '%h/logs/'</para> + </listitem> +</itemizedlist> + +<command>logger.file.time_format</command> +<itemizedlist> + <listitem> + <para>description: format de date/heure utilisé dans les fichiers log (voir strftime(3) pour le format de date/heure)</para> + </listitem> + <listitem> + <para>type: chaîne</para> + </listitem> + <listitem> + <para>valeurs: toute chaîne</para> + </listitem> + <listitem> + <para>valeur par défaut: '%Y-%m-%d %H:%M:%S'</para> + </listitem> +</itemizedlist> + +<command>logger.look.backlog</command> +<itemizedlist> + <listitem> + <para>description: nombre maximum de lignes à afficher du fichier de log lors de l'ouverture du tampon (0 = ne rien afficher)</para> + </listitem> + <listitem> + <para>type: entier</para> + </listitem> + <listitem> + <para>valeurs: 0 .. 2147483647</para> + </listitem> + <listitem> + <para>valeur par défaut: 20</para> + </listitem> +</itemizedlist> + diff --git a/doc/include_autogen.xml b/doc/include_autogen.xml index 25d8caffc..0c2035e45 100644 --- a/doc/include_autogen.xml +++ b/doc/include_autogen.xml @@ -17,6 +17,7 @@ <!-- config options --> <!ENTITY irc_options.xml SYSTEM "autogen/irc_options.xml"> +<!ENTITY logger_options.xml SYSTEM "autogen/logger_options.xml"> <!ENTITY weechat_options.xml SYSTEM "autogen/weechat_options.xml"> <!ENTITY xfer_options.xml SYSTEM "autogen/xfer_options.xml"> diff --git a/po/POTFILES.in b/po/POTFILES.in index 5f973e0ed..8a0b8cb53 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -138,6 +138,8 @@ ./src/plugins/logger/logger.h ./src/plugins/logger/logger-buffer.c ./src/plugins/logger/logger-buffer.h +./src/plugins/logger/logger-config.c +./src/plugins/logger/logger-config.h ./src/plugins/logger/logger-info.c ./src/plugins/logger/logger-info.h ./src/plugins/logger/logger-tail.c @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-10-05 17:39+0200\n" +"POT-Creation-Date: 2008-10-08 13:12+0200\n" "PO-Revision-Date: 2008-09-17 16:19+0200\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -3979,6 +3979,10 @@ msgid "%s%s: disconnected from server" msgstr "Odpojen od serveru!\n" #, fuzzy, c-format +msgid "%s%s: unable to create directory for logs (\"%s\")" +msgstr "%s nemohu vytvořit server \"%s\"\n" + +#, fuzzy, c-format msgid "%s%s: unable to write log file \"%s\"" msgstr "Nemůžu zapsat log soubor \"%s\"\n" @@ -3995,6 +3999,33 @@ msgid "===\t========== End of backlog (%d lines) ==========" msgstr "===\t========== Konec zpětného logu (%d řádků) ==========" #, fuzzy +msgid "" +"maximum number of lines to display from log file when creating new buffer (0 " +"= no backlog)" +msgstr "maximální počet uživatelských příkazů v historii (0 = nekonečně)" + +msgid "" +"automatically save content of buffers to files (unless a buffer disables log)" +msgstr "" + +msgid "use only lower case for log filenames" +msgstr "" + +#, fuzzy +msgid "" +"path for WeeChat log files ('%h' will be replaced by WeeChat home, ~/." +"weechat by default)" +msgstr "" +"cesta pro hledání pluginů ('%h' bude nahrazeno domácím adresářem WeeChat, ~/." +"weechat je výchozí)" + +msgid "write information line in log file when log starts or ends for a buffer" +msgstr "" + +msgid "timestamp used in log files (see man strftime for date/time specifiers)" +msgstr "" + +#, fuzzy msgid "list of logger buffers" msgstr "časová známka pro buffer" @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-10-05 17:39+0200\n" +"POT-Creation-Date: 2008-10-08 13:12+0200\n" "PO-Revision-Date: 2007-09-06 12:44+0200\n" "Last-Translator: Thomas Schuetz <i18n@internet-villa.de>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -3889,6 +3889,10 @@ msgid "%s%s: disconnected from server" msgstr "Vom Server getrennt!\n" #, fuzzy, c-format +msgid "%s%s: unable to create directory for logs (\"%s\")" +msgstr "%s kann den Server nicht anlegen\n" + +#, fuzzy, c-format msgid "%s%s: unable to write log file \"%s\"" msgstr "Kann das Logfile nicht schreiben\n" @@ -3905,6 +3909,33 @@ msgid "===\t========== End of backlog (%d lines) ==========" msgstr "" #, fuzzy +msgid "" +"maximum number of lines to display from log file when creating new buffer (0 " +"= no backlog)" +msgstr "maximale Anzahl an Befehlen im Verlauf (0: kein Limit)" + +msgid "" +"automatically save content of buffers to files (unless a buffer disables log)" +msgstr "" + +msgid "use only lower case for log filenames" +msgstr "" + +#, fuzzy +msgid "" +"path for WeeChat log files ('%h' will be replaced by WeeChat home, ~/." +"weechat by default)" +msgstr "" +"Suchpfad für WeeChat-Plugins ('%h' wird durch das WeeChat-Basisiverzeichnis " +"ersetzt, voreingestellt ist ~/.weechat)" + +msgid "write information line in log file when log starts or ends for a buffer" +msgstr "" + +msgid "timestamp used in log files (see man strftime for date/time specifiers)" +msgstr "" + +#, fuzzy msgid "list of logger buffers" msgstr "Timestamp für Puffer" @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-10-05 17:39+0200\n" +"POT-Creation-Date: 2008-10-08 13:12+0200\n" "PO-Revision-Date: 2007-09-19 12:09+0200\n" "Last-Translator: Roberto González Cardenete <robert.glez@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -3888,6 +3888,10 @@ msgid "%s%s: disconnected from server" msgstr "¡Desconectado del servidor!\n" #, fuzzy, c-format +msgid "%s%s: unable to create directory for logs (\"%s\")" +msgstr "%s no es posible crear el servidor\n" + +#, fuzzy, c-format msgid "%s%s: unable to write log file \"%s\"" msgstr "No es posible escribir un fichero de log para un búfer\n" @@ -3904,6 +3908,34 @@ msgid "===\t========== End of backlog (%d lines) ==========" msgstr "" #, fuzzy +msgid "" +"maximum number of lines to display from log file when creating new buffer (0 " +"= no backlog)" +msgstr "" +"número múximo de comandos de usuario en el histórico (0 = ilimitado)" + +msgid "" +"automatically save content of buffers to files (unless a buffer disables log)" +msgstr "" + +msgid "use only lower case for log filenames" +msgstr "" + +#, fuzzy +msgid "" +"path for WeeChat log files ('%h' will be replaced by WeeChat home, ~/." +"weechat by default)" +msgstr "" +"ruta para encontrar plugins ('%h' será reemplazado por el directorio raÃz " +"de Weechat, ~/.weechat por defecto)" + +msgid "write information line in log file when log starts or ends for a buffer" +msgstr "" + +msgid "timestamp used in log files (see man strftime for date/time specifiers)" +msgstr "" + +#, fuzzy msgid "list of logger buffers" msgstr "fecha y hora para las búfers" @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-10-05 17:39+0200\n" -"PO-Revision-Date: 2008-10-05 17:39+0200\n" +"POT-Creation-Date: 2008-10-08 13:12+0200\n" +"PO-Revision-Date: 2008-10-08 13:13+0200\n" "Last-Translator: FlashCode <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "MIME-Version: 1.0\n" @@ -3932,6 +3932,10 @@ msgid "%s%s: disconnected from server" msgstr "%s%s: déconnecté du serveur" #, c-format +msgid "%s%s: unable to create directory for logs (\"%s\")" +msgstr "%s%s: impossible de créer le répertoire pour les logs (\"%s\")" + +#, c-format msgid "%s%s: unable to write log file \"%s\"" msgstr "%s%s: impossible d'écrire le fichier log \"%s\"" @@ -3947,6 +3951,39 @@ msgstr "%s\t**** Fin du log ****" msgid "===\t========== End of backlog (%d lines) ==========" msgstr "===\t========== Fin de l'historique (%d lignes) ==========" +msgid "" +"maximum number of lines to display from log file when creating new buffer (0 " +"= no backlog)" +msgstr "" +"nombre maximum de lignes à afficher du fichier de log lors de l'ouverture du " +"tampon (0 = ne rien afficher)" + +msgid "" +"automatically save content of buffers to files (unless a buffer disables log)" +msgstr "" +"sauve automatiquement le contenu des tampons dans des fichiers (sauf si un " +"tampon désactive le log)" + +msgid "use only lower case for log filenames" +msgstr "utiliser seulement des minuscules dans le nom des fichiers de log" + +msgid "" +"path for WeeChat log files ('%h' will be replaced by WeeChat home, ~/." +"weechat by default)" +msgstr "" +"chemin pour les fichiers de log WeeChat ('%h' sera remplacé par le " +"répertoire de base WeeChat, par défaut: ~/.weechat)" + +msgid "write information line in log file when log starts or ends for a buffer" +msgstr "" +"écrire une ligne d'information dans le fichier log quand le log démarre ou " +"se termine pour un tampon" + +msgid "timestamp used in log files (see man strftime for date/time specifiers)" +msgstr "" +"format de date/heure utilisé dans les fichiers log (voir strftime(3) pour le " +"format de date/heure)" + msgid "list of logger buffers" msgstr "liste des enregistreurs de tampons (loggers)" @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-10-05 17:39+0200\n" +"POT-Creation-Date: 2008-10-08 13:12+0200\n" "PO-Revision-Date: 2007-10-10 18:07+0200\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -3916,6 +3916,10 @@ msgid "%s%s: disconnected from server" msgstr "Lekapcsolódott a szerverről!\n" #, fuzzy, c-format +msgid "%s%s: unable to create directory for logs (\"%s\")" +msgstr "%s nem sikerült a szervert létrehozni\n" + +#, fuzzy, c-format msgid "%s%s: unable to write log file \"%s\"" msgstr "Nem sikerült a(z) \"%s\" naplófájlt írni\n" @@ -3932,6 +3936,34 @@ msgid "===\t========== End of backlog (%d lines) ==========" msgstr "" #, fuzzy +msgid "" +"maximum number of lines to display from log file when creating new buffer (0 " +"= no backlog)" +msgstr "" +"felhasználói parancsok maximális száma az előzményekben (0 = korlátlan)" + +msgid "" +"automatically save content of buffers to files (unless a buffer disables log)" +msgstr "" + +msgid "use only lower case for log filenames" +msgstr "" + +#, fuzzy +msgid "" +"path for WeeChat log files ('%h' will be replaced by WeeChat home, ~/." +"weechat by default)" +msgstr "" +"modulok elérési útvonala ('%h' helyére automatikusan a WeeChat saját " +"könyvtára, alapértelmezésben ~/.weechat, kerül)" + +msgid "write information line in log file when log starts or ends for a buffer" +msgstr "" + +msgid "timestamp used in log files (see man strftime for date/time specifiers)" +msgstr "" + +#, fuzzy msgid "list of logger buffers" msgstr "a pufferek időbélyege" @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-10-05 17:39+0200\n" +"POT-Creation-Date: 2008-10-08 13:12+0200\n" "PO-Revision-Date: 2007-09-06 12:44+0200\n" "Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -3904,6 +3904,10 @@ msgid "%s%s: disconnected from server" msgstr "Отключен от сервера!\n" #, fuzzy, c-format +msgid "%s%s: unable to create directory for logs (\"%s\")" +msgstr "%s не могу создать сервер \"%s\"\n" + +#, fuzzy, c-format msgid "%s%s: unable to write log file \"%s\"" msgstr "Не могу записать лог-файл \"%s\"\n" @@ -3920,6 +3924,33 @@ msgid "===\t========== End of backlog (%d lines) ==========" msgstr "" #, fuzzy +msgid "" +"maximum number of lines to display from log file when creating new buffer (0 " +"= no backlog)" +msgstr "максимальное количество команд в истории (0 = не ограничено)" + +msgid "" +"automatically save content of buffers to files (unless a buffer disables log)" +msgstr "" + +msgid "use only lower case for log filenames" +msgstr "" + +#, fuzzy +msgid "" +"path for WeeChat log files ('%h' will be replaced by WeeChat home, ~/." +"weechat by default)" +msgstr "" +"путь поиска pluginов ('%h' заменяется на домашний каталог WeeChat, по " +"умолчанию - ~/.weechat)" + +msgid "write information line in log file when log starts or ends for a buffer" +msgstr "" + +msgid "timestamp used in log files (see man strftime for date/time specifiers)" +msgstr "" + +#, fuzzy msgid "list of logger buffers" msgstr "время в буферах" diff --git a/po/srcfiles.cmake b/po/srcfiles.cmake index f88c32fa3..414107650 100644 --- a/po/srcfiles.cmake +++ b/po/srcfiles.cmake @@ -139,6 +139,8 @@ SET(WEECHAT_SOURCES ./src/plugins/logger/logger.h ./src/plugins/logger/logger-buffer.c ./src/plugins/logger/logger-buffer.h +./src/plugins/logger/logger-config.c +./src/plugins/logger/logger-config.h ./src/plugins/logger/logger-info.c ./src/plugins/logger/logger-info.h ./src/plugins/logger/logger-tail.c diff --git a/po/weechat.pot b/po/weechat.pot index 88fc75e65..d9fba2559 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-10-05 17:39+0200\n" +"POT-Creation-Date: 2008-10-08 13:12+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -3353,6 +3353,10 @@ msgid "%s%s: disconnected from server" msgstr "" #, c-format +msgid "%s%s: unable to create directory for logs (\"%s\")" +msgstr "" + +#, c-format msgid "%s%s: unable to write log file \"%s\"" msgstr "" @@ -3368,6 +3372,29 @@ msgstr "" msgid "===\t========== End of backlog (%d lines) ==========" msgstr "" +msgid "" +"maximum number of lines to display from log file when creating new buffer (0 " +"= no backlog)" +msgstr "" + +msgid "" +"automatically save content of buffers to files (unless a buffer disables log)" +msgstr "" + +msgid "use only lower case for log filenames" +msgstr "" + +msgid "" +"path for WeeChat log files ('%h' will be replaced by WeeChat home, ~/." +"weechat by default)" +msgstr "" + +msgid "write information line in log file when log starts or ends for a buffer" +msgstr "" + +msgid "timestamp used in log files (see man strftime for date/time specifiers)" +msgstr "" + msgid "list of logger buffers" msgstr "" diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index 7dfe544cd..7a6285bca 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -1155,3 +1155,13 @@ irc_config_write () { return weechat_config_write (irc_config_file); } + +/* + * irc_config_free: free IRC configuration + */ + +void +irc_config_free () +{ + weechat_config_free (irc_config_file); +} diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h index 170533b87..9a6f80b16 100644 --- a/src/plugins/irc/irc-config.h +++ b/src/plugins/irc/irc-config.h @@ -108,5 +108,6 @@ struct t_config_option *irc_config_server_new_option (struct t_config_file *conf extern int irc_config_init (); extern int irc_config_read (); extern int irc_config_write (); +extern void irc_config_free (); #endif /* irc-config.h */ diff --git a/src/plugins/irc/irc.c b/src/plugins/irc/irc.c index d836f02ce..ae567ff26 100644 --- a/src/plugins/irc/irc.c +++ b/src/plugins/irc/irc.c @@ -110,7 +110,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) if (!irc_config_init ()) return WEECHAT_RC_ERROR; - + if (irc_config_read () < 0) return WEECHAT_RC_ERROR; @@ -205,5 +205,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin) irc_server_free_all (); + irc_config_free (); + return WEECHAT_RC_OK; } diff --git a/src/plugins/logger/CMakeLists.txt b/src/plugins/logger/CMakeLists.txt index 816d2cc6a..a3e9457ca 100644 --- a/src/plugins/logger/CMakeLists.txt +++ b/src/plugins/logger/CMakeLists.txt @@ -17,6 +17,7 @@ ADD_LIBRARY(logger MODULE logger.c logger.h logger-buffer.c logger-buffer.h +logger-config.c logger-config.h logger-info.c logger-info.h logger-tail.c logger-tail.h) SET_TARGET_PROPERTIES(logger PROPERTIES PREFIX "") diff --git a/src/plugins/logger/Makefile.am b/src/plugins/logger/Makefile.am index 89f7966e5..2f76c7993 100644 --- a/src/plugins/logger/Makefile.am +++ b/src/plugins/logger/Makefile.am @@ -24,6 +24,8 @@ logger_la_SOURCES = logger.c \ logger.h \ logger-buffer.c \ logger-buffer.h \ + logger-config.c \ + logger-config.h \ logger-info.c \ logger-info.h \ logger-tail.c \ diff --git a/src/plugins/logger/logger-config.c b/src/plugins/logger/logger-config.c new file mode 100644 index 000000000..507a8a1e7 --- /dev/null +++ b/src/plugins/logger/logger-config.c @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org> + * See README for License detail, AUTHORS for developers list. + * + * 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 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * 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, see <http://www.gnu.org/licenses/>. + */ + +/* logger-config.c: logger configuration options */ + + +#include <stdlib.h> +#include <limits.h> + +#include "../weechat-plugin.h" +#include "logger.h" +#include "logger-config.h" + + +struct t_config_file *logger_config_file = NULL; + +/* logger config, look section */ + +struct t_config_option *logger_config_look_backlog; + +/* logger config, file section */ + +struct t_config_option *logger_config_file_auto_log; +struct t_config_option *logger_config_file_name_lower_case; +struct t_config_option *logger_config_file_path; +struct t_config_option *logger_config_file_info_lines; +struct t_config_option *logger_config_file_time_format; + + +/* + * logger_config_init: init logger configuration file + * return: 1 if ok, 0 if error + */ + +int +logger_config_init () +{ + struct t_config_section *ptr_section; + + logger_config_file = weechat_config_new (LOGGER_CONFIG_NAME, + NULL, NULL); + if (!logger_config_file) + return 0; + + /* look */ + ptr_section = weechat_config_new_section (logger_config_file, "look", + 0, 0, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL); + if (!ptr_section) + { + weechat_config_free (logger_config_file); + return 0; + } + + logger_config_look_backlog = weechat_config_new_option ( + logger_config_file, ptr_section, + "backlog", "integer", + N_("maximum number of lines to display from log file when creating " + "new buffer (0 = no backlog)"), + NULL, 0, INT_MAX, "20", NULL, NULL, NULL, NULL, NULL, NULL); + + /* file */ + ptr_section = weechat_config_new_section (logger_config_file, "file", + 0, 0, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL); + if (!ptr_section) + { + weechat_config_free (logger_config_file); + return 0; + } + + logger_config_file_auto_log = weechat_config_new_option ( + logger_config_file, ptr_section, + "auto_log", "boolean", + N_("automatically save content of buffers to files (unless a buffer " + "disables log)"), + NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL); + logger_config_file_name_lower_case = weechat_config_new_option ( + logger_config_file, ptr_section, + "name_lower_case", "boolean", + N_("use only lower case for log filenames"), + NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL); + logger_config_file_path = weechat_config_new_option ( + logger_config_file, ptr_section, + "path", "string", + N_("path for WeeChat log files ('%h' will be replaced by WeeChat " + "home, ~/.weechat by default)"), + NULL, 0, 0, "%h/logs/", NULL, NULL, NULL, NULL, NULL, NULL); + logger_config_file_info_lines = weechat_config_new_option ( + logger_config_file, ptr_section, + "info_lines", "boolean", + N_("write information line in log file when log starts or ends for a " + "buffer"), + NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL); + logger_config_file_time_format = weechat_config_new_option ( + logger_config_file, ptr_section, + "time_format", "string", + N_("timestamp used in log files (see man strftime for date/time " + "specifiers)"), + NULL, 0, 0, "%Y-%m-%d %H:%M:%S", NULL, NULL, NULL, NULL, NULL, NULL); + + return 1; +} + +/* + * logger_config_read: read logger configuration file + */ + +int +logger_config_read () +{ + return weechat_config_read (logger_config_file); +} + +/* + * logger_config_write: write logger configuration file + */ + +int +logger_config_write () +{ + return weechat_config_write (logger_config_file); +} + +/* + * logger_config_free: free logger configuration + */ + +void +logger_config_free () +{ + weechat_config_free (logger_config_file); +} diff --git a/src/plugins/logger/logger-config.h b/src/plugins/logger/logger-config.h new file mode 100644 index 000000000..e789e7f7a --- /dev/null +++ b/src/plugins/logger/logger-config.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org> + * See README for License detail, AUTHORS for developers list. + * + * 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 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * 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, see <http://www.gnu.org/licenses/>. + */ + + +#ifndef __WEECHAT_LOGGER_CONFIG_H +#define __WEECHAT_LOGGER_CONFIG_H 1 + +#define LOGGER_CONFIG_NAME "logger" + + +extern struct t_config_file *logger_config_file; + +extern struct t_config_option *logger_config_look_backlog; + +extern struct t_config_option *logger_config_file_auto_log; +extern struct t_config_option *logger_config_file_name_lower_case; +extern struct t_config_option *logger_config_file_path; +extern struct t_config_option *logger_config_file_info_lines; +extern struct t_config_option *logger_config_file_time_format; + +extern int logger_config_init (); +extern int logger_config_read (); +extern int logger_config_write (); +extern void logger_config_free (); + +#endif /* logger-config.h */ diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c index cb8e7db17..522216d3e 100644 --- a/src/plugins/logger/logger.c +++ b/src/plugins/logger/logger.c @@ -37,6 +37,7 @@ #include "../weechat-plugin.h" #include "logger.h" #include "logger-buffer.h" +#include "logger-config.h" #include "logger-info.h" #include "logger-tail.h" @@ -50,145 +51,13 @@ WEECHAT_PLUGIN_LICENSE("GPL3"); struct t_weechat_plugin *weechat_logger_plugin = NULL; -#define LOGGER_OPTION_AUTO_LOG "auto_log" -#define LOGGER_OPTION_PATH "path" -#define LOGGER_OPTION_NAME_LOWER_CASE "name_lower_case" -#define LOGGER_OPTION_TIME_FORMAT "time_format" -#define LOGGER_OPTION_INFO_LINES "info_lines" -#define LOGGER_OPTION_BACKLOG "backlog" - -#define LOGGER_DEFAULT_OPTION_AUTO_LOG "on" -#define LOGGER_DEFAULT_OPTION_PATH "%h/logs/" -#define LOGGER_DEFAULT_OPTION_NAME_LOWER_CASE "on" -#define LOGGER_DEFAULT_OPTION_TIME_FORMAT "%Y-%m-%d %H:%M:%S" -#define LOGGER_DEFAULT_OPTION_INFO_LINES "off" -#define LOGGER_DEFAULT_OPTION_BACKLOG "20" - -int logger_option_auto_log = 0; -char *logger_option_path = NULL; -int logger_option_name_lower_case = 0; -char *logger_option_time_format = NULL; -int logger_option_info_lines = 0; -int logger_option_backlog = 0; - char *logger_buf_write = NULL; /* buffer for writing a line */ /* - * logger_config_read: read config options for logger plugin - * return: 1 if ok - * 0 if error - */ - -int -logger_config_read () -{ - long number; - char *string, *error; - int old_auto_log; - - /* option "auto_log" */ - old_auto_log = logger_option_auto_log; - string = weechat_config_get_plugin (LOGGER_OPTION_AUTO_LOG); - if (!string) - { - weechat_config_set_plugin (LOGGER_OPTION_AUTO_LOG, - LOGGER_DEFAULT_OPTION_AUTO_LOG); - string = weechat_config_get_plugin (LOGGER_OPTION_AUTO_LOG); - } - if (string && (weechat_config_string_to_boolean (string) > 0)) - logger_option_auto_log = 1; - else - logger_option_auto_log = 0; - - /* option "path" */ - if (logger_option_path) - free (logger_option_path); - logger_option_path = weechat_config_get_plugin (LOGGER_OPTION_PATH); - if (!logger_option_path) - { - weechat_config_set_plugin (LOGGER_OPTION_PATH, - LOGGER_DEFAULT_OPTION_PATH); - logger_option_path = weechat_config_get_plugin ("path"); - } - if (logger_option_path) - logger_option_path = strdup (logger_option_path); - - /* option "name_lower_case" */ - string = weechat_config_get_plugin (LOGGER_OPTION_NAME_LOWER_CASE); - if (!string) - { - weechat_config_set_plugin (LOGGER_OPTION_NAME_LOWER_CASE, - LOGGER_DEFAULT_OPTION_NAME_LOWER_CASE); - string = weechat_config_get_plugin (LOGGER_OPTION_NAME_LOWER_CASE); - } - if (string && (weechat_config_string_to_boolean (string) > 0)) - logger_option_name_lower_case = 1; - else - logger_option_name_lower_case = 0; - - /* option "time_format" */ - if (logger_option_time_format) - free (logger_option_time_format); - logger_option_time_format = weechat_config_get_plugin (LOGGER_OPTION_TIME_FORMAT); - if (!logger_option_time_format) - { - weechat_config_set_plugin (LOGGER_OPTION_TIME_FORMAT, - LOGGER_DEFAULT_OPTION_TIME_FORMAT); - logger_option_time_format = weechat_config_get_plugin (LOGGER_OPTION_TIME_FORMAT); - } - if (logger_option_time_format) - logger_option_time_format = strdup (logger_option_time_format); - - /* option "info_lines" */ - string = weechat_config_get_plugin (LOGGER_OPTION_INFO_LINES); - if (!string) - { - weechat_config_set_plugin (LOGGER_OPTION_INFO_LINES, - LOGGER_DEFAULT_OPTION_INFO_LINES); - string = weechat_config_get_plugin (LOGGER_OPTION_INFO_LINES); - } - if (string && (weechat_config_string_to_boolean (string) > 0)) - logger_option_info_lines = 1; - else - logger_option_info_lines = 0; - - /* option "backlog" */ - string = weechat_config_get_plugin (LOGGER_OPTION_BACKLOG); - if (!string) - { - weechat_config_set_plugin (LOGGER_OPTION_BACKLOG, - LOGGER_DEFAULT_OPTION_BACKLOG); - string = weechat_config_get_plugin (LOGGER_OPTION_BACKLOG); - } - logger_option_backlog = 20; - if (string) - { - error = NULL; - number = strtol (string, &error, 10); - if (error && !error[0]) - logger_option_backlog = number; - } - - /* start/stop logging for all buffers if option "auto_log" is changed */ - if (old_auto_log != logger_option_auto_log) - { - if (logger_option_auto_log) - logger_start_buffer_all (); - else - logger_stop_all (); - } - - /* return 1 (ok) if path and time format are defined */ - if (logger_option_path && logger_option_time_format) - return 1; - else - return 0; -} - -/* * logger_create_directory: create logger directory - * return 1 if success, 0 if failed + * return 1 if success (directory created or already + * exists), 0 if failed */ int @@ -199,7 +68,8 @@ logger_create_directory () rc = 1; - dir1 = weechat_string_replace (logger_option_path, "~", getenv ("HOME")); + dir1 = weechat_string_replace (weechat_config_string (logger_config_file_path), + "~", getenv ("HOME")); if (dir1) { weechat_dir = weechat_info_get ("weechat_dir", ""); @@ -247,8 +117,8 @@ logger_get_filename (struct t_gui_buffer *buffer) dir_separator = weechat_info_get ("dir_separator", ""); weechat_dir = weechat_info_get ("weechat_dir", ""); - log_path = weechat_string_replace (logger_option_path, "~", - getenv ("HOME")); + log_path = weechat_string_replace (weechat_config_string (logger_config_file_path), + "~", getenv ("HOME")); log_path2 = weechat_string_replace (log_path, "%h", weechat_dir); if (dir_separator && weechat_dir && log_path && log_path2) @@ -278,14 +148,14 @@ logger_get_filename (struct t_gui_buffer *buffer) strcpy (res, log_path2); if (plugin_name2) { - if (logger_option_name_lower_case) + if (weechat_config_boolean (logger_config_file_name_lower_case)) weechat_string_tolower (plugin_name2); strcat (res, plugin_name2); strcat (res, "."); } if (name2) { - if (logger_option_name_lower_case) + if (weechat_config_boolean (logger_config_file_name_lower_case)) weechat_string_tolower (name2); strcat (res, name2); strcat (res, "."); @@ -331,6 +201,17 @@ logger_write_line (struct t_logger_buffer *logger_buffer, if (!logger_buffer->log_file) { + if (!logger_create_directory ()) + { + weechat_printf (NULL, + _("%s%s: unable to create directory for logs " + "(\"%s\")"), + weechat_prefix ("error"), LOGGER_PLUGIN_NAME, + weechat_config_string (logger_config_file_path)); + free (logger_buffer->log_filename); + logger_buffer->log_filename = NULL; + return; + } logger_buffer->log_file = fopen (logger_buffer->log_filename, "a"); if (!logger_buffer->log_file) @@ -344,14 +225,15 @@ logger_write_line (struct t_logger_buffer *logger_buffer, return; } - if (logger_option_info_lines) + if (weechat_config_boolean (logger_config_file_info_lines)) { seconds = time (NULL); date_tmp = localtime (&seconds); buf_time[0] = '\0'; if (date_tmp) strftime (buf_time, sizeof (buf_time) - 1, - logger_option_time_format, date_tmp); + weechat_config_string (logger_config_file_time_format), + date_tmp); snprintf (logger_buf_write, LOGGER_BUF_WRITE_SIZE, _("%s\t**** Beginning of log ****"), buf_time); @@ -389,7 +271,7 @@ logger_start_buffer (struct t_gui_buffer *buffer) struct t_logger_buffer *ptr_logger_buffer; char *log_filename; - if (!buffer || !logger_option_auto_log) + if (!buffer || !weechat_config_boolean (logger_config_file_auto_log)) return; ptr_logger_buffer = logger_buffer_search (buffer); @@ -451,14 +333,15 @@ logger_stop (struct t_logger_buffer *logger_buffer, int write_info_line) if (logger_buffer->log_file) { - if (write_info_line && logger_option_info_lines) + if (write_info_line && weechat_config_boolean (logger_config_file_info_lines)) { seconds = time (NULL); date_tmp = localtime (&seconds); buf_time[0] = '\0'; if (date_tmp) strftime (buf_time, sizeof (buf_time) - 1, - logger_option_time_format, date_tmp); + weechat_config_string (logger_config_file_time_format), + date_tmp); logger_write_line (logger_buffer, _("%s\t**** End of log ****"), buf_time); @@ -544,7 +427,8 @@ logger_backlog (struct t_gui_buffer *buffer, const char *filename, int lines) if (pos_message) { pos_message[0] = '\0'; - error = strptime (ptr_lines->data, logger_option_time_format, + error = strptime (ptr_lines->data, + weechat_config_string (logger_config_file_time_format), &tm_line); if (error && !error[0]) datetime = mktime (&tm_line); @@ -587,7 +471,7 @@ logger_backlog_signal_cb (void *data, const char *signal, (void) signal; (void) type_data; - if (logger_option_backlog >= 0) + if (weechat_config_integer (logger_config_look_backlog) >= 0) { ptr_logger_buffer = logger_buffer_search (signal_data); if (ptr_logger_buffer && ptr_logger_buffer->log_filename @@ -597,7 +481,7 @@ logger_backlog_signal_cb (void *data, const char *signal, logger_backlog (signal_data, ptr_logger_buffer->log_filename, - logger_option_backlog); + weechat_config_integer (logger_config_look_backlog)); ptr_logger_buffer->log_enabled = 1; } @@ -674,7 +558,8 @@ logger_print_cb (void *data, struct t_gui_buffer *buffer, time_t date, if (date_tmp) { strftime (buf_time, sizeof (buf_time) - 1, - logger_option_time_format, date_tmp); + weechat_config_string (logger_config_file_time_format), + date_tmp); } logger_write_line (ptr_logger_buffer, @@ -717,9 +602,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) weechat_plugin = plugin; - if (!logger_config_read ()) + if (!logger_config_init ()) return WEECHAT_RC_ERROR; - if (!logger_create_directory ()) + + if (logger_config_read () < 0) return WEECHAT_RC_ERROR; logger_start_buffer_all (); @@ -749,12 +635,11 @@ weechat_plugin_end (struct t_weechat_plugin *plugin) /* make C compiler happy */ (void) plugin; + logger_config_write (); + logger_stop_all (); - if (logger_option_path) - free (logger_option_path); - if (logger_option_time_format) - free (logger_option_time_format); + logger_config_free (); if (logger_buf_write) free (logger_buf_write); |