1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-29 06:16:40 +02:00

logger: evaluate content of option logger.file.path (issue #388)

This commit is contained in:
Sébastien Helleu
2015-06-20 08:08:24 +02:00
parent 292830b5bf
commit 33a4b4b1fc
21 changed files with 72 additions and 53 deletions
+1
View File
@@ -20,6 +20,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
=== New features
* core: add signal "signal_sighup"
* logger: evaluate content of option logger.file.path (issue #388)
* relay: display value of HTTP header "X-Real-IP" for websocket connections
(closes #440)
* script: evaluate content of option script.scripts.dir (issue #388)
+1 -1
View File
@@ -48,7 +48,7 @@
** Werte: beliebige Zeichenkette (Standardwert: `""`)
* [[option_logger.file.path]] *logger.file.path*
** Beschreibung: `Pfad für WeeChat Protokolldateien; "%h" wird durch das WeeChat Verzeichnis ersetzt (Standardpfad: "~/.weechat"); eine Datumsspezifikation ist zulässig (siehe: man strftime)`
** Beschreibung: `path for WeeChat log files; "%h" at beginning of string is replaced by WeeChat home ("~/.weechat" by default); date specifiers are permitted (see man strftime) (note: content is evaluated, see /help eval)`
** Typ: Zeichenkette
** Werte: beliebige Zeichenkette (Standardwert: `"%h/logs/"`)
+1 -1
View File
@@ -48,7 +48,7 @@
** values: any string (default value: `""`)
* [[option_logger.file.path]] *logger.file.path*
** description: `path for WeeChat log files; "%h" at beginning of string is replaced by WeeChat home ("~/.weechat" by default); date specifiers are permitted (see man strftime)`
** description: `path for WeeChat log files; "%h" at beginning of string is replaced by WeeChat home ("~/.weechat" by default); date specifiers are permitted (see man strftime) (note: content is evaluated, see /help eval)`
** type: string
** values: any string (default value: `"%h/logs/"`)
+1 -1
View File
@@ -48,7 +48,7 @@
** valeurs: toute chaîne (valeur par défaut: `""`)
* [[option_logger.file.path]] *logger.file.path*
** description: `chemin pour les fichiers de log WeeChat ; "%h" au début de la chaîne est remplacé par le répertoire de base WeeChat (par défaut : "~/.weechat") ; les caractères de formatage de date sont autorisés (voir man strftime)`
** description: `chemin pour les fichiers de log WeeChat ; "%h" au début de la chaîne est remplacé par le répertoire de base WeeChat (par défaut : "~/.weechat") ; les caractères de formatage de date sont autorisés (voir man strftime) (note : le contenu est évalué, voir /help eval)`
** type: chaîne
** valeurs: toute chaîne (valeur par défaut: `"%h/logs/"`)
+1 -1
View File
@@ -48,7 +48,7 @@
** valori: qualsiasi stringa (valore predefinito: `""`)
* [[option_logger.file.path]] *logger.file.path*
** descrizione: `path per i file di log di WeeChat: "%h" all'inizio della stringa viene sostituito dalla directory home di WeeChat (predefinita è "~/.weechat); sono ammessi gli specificatori di data (consultare man strftime)`
** descrizione: `path for WeeChat log files; "%h" at beginning of string is replaced by WeeChat home ("~/.weechat" by default); date specifiers are permitted (see man strftime) (note: content is evaluated, see /help eval)`
** tipo: stringa
** valori: qualsiasi stringa (valore predefinito: `"%h/logs/"`)
+1 -1
View File
@@ -48,7 +48,7 @@
** 値: 未制約文字列 (デフォルト値: `""`)
* [[option_logger.file.path]] *logger.file.path*
** 説明: `WeeChat ログファイルのパス; 文字列最初の "%h" は WeeChat ホーム (デフォルトでは "~/.weechat") に置換; 日付指定子を使える (strftime の man を参照)`
** 説明: `path for WeeChat log files; "%h" at beginning of string is replaced by WeeChat home ("~/.weechat" by default); date specifiers are permitted (see man strftime) (note: content is evaluated, see /help eval)`
** タイプ: 文字列
** 値: 未制約文字列 (デフォルト値: `"%h/logs/"`)
+1 -1
View File
@@ -48,7 +48,7 @@
** wartości: dowolny ciąg (domyślna wartość: `""`)
* [[option_logger.file.path]] *logger.file.path*
** opis: `ścieżka do plików z logami WeeChat; "%h" na początku ciągu zostanie zastąpione przez katalog domowy WeeChat (domyślnie "~/.weechat"); określenia dla daty są dozwolone (zobacz man strftime)`
** opis: `path for WeeChat log files; "%h" at beginning of string is replaced by WeeChat home ("~/.weechat" by default); date specifiers are permitted (see man strftime) (note: content is evaluated, see /help eval)`
** typ: ciąg
** wartości: dowolny ciąg (domyślna wartość: `"%h/logs/"`)
+3 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-19 21:06+0200\n"
"POT-Creation-Date: 2015-06-20 08:05+0200\n"
"PO-Revision-Date: 2015-03-21 08:41+0100\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -8597,10 +8597,11 @@ msgstr ""
msgid "text to write after nick in prefix of message, example: \">\""
msgstr ""
#, fuzzy
msgid ""
"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
"man strftime)"
"man strftime) (note: content is evaluated, see /help eval)"
msgstr ""
"cesta pro logovací soubory WeeChat; \"%h\" na záčátku řetězce je nahrazeno "
"domácím adresářem WeeChat (\"~/.weechat\" je výchozí); jsou povoleny "
+3 -2
View File
@@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-19 21:06+0200\n"
"POT-Creation-Date: 2015-06-20 08:05+0200\n"
"PO-Revision-Date: 2015-06-13 22:57+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <>\n"
@@ -9828,10 +9828,11 @@ msgstr "Zeichenkette, die dem Nick vorangestellt werden soll. Beispiel: \"<\""
msgid "text to write after nick in prefix of message, example: \">\""
msgstr "Zeichenkette, die nach dem Nick eingefügt werden soll. Beispiel: \">\""
#, fuzzy
msgid ""
"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
"man strftime)"
"man strftime) (note: content is evaluated, see /help eval)"
msgstr ""
"Pfad für WeeChat Protokolldateien; \"%h\" wird durch das WeeChat Verzeichnis "
"ersetzt (Standardpfad: \"~/.weechat\"); eine Datumsspezifikation ist "
+3 -2
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-19 21:06+0200\n"
"POT-Creation-Date: 2015-06-20 08:05+0200\n"
"PO-Revision-Date: 2015-03-21 08:41+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -8901,10 +8901,11 @@ msgstr ""
msgid "text to write after nick in prefix of message, example: \">\""
msgstr ""
#, fuzzy
msgid ""
"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
"man strftime)"
"man strftime) (note: content is evaluated, see /help eval)"
msgstr ""
"ruta para los registros de WeeChat; \"%h\" al principio de la cadena será "
"reemplazado por el directorio raíz de WeeChat (\"~/.weechat\" por defecto); "
+5 -4
View File
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-19 21:06+0200\n"
"PO-Revision-Date: 2015-06-19 21:07+0200\n"
"POT-Creation-Date: 2015-06-20 08:05+0200\n"
"PO-Revision-Date: 2015-06-20 08:06+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -9585,11 +9585,12 @@ msgstr ""
msgid ""
"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
"man strftime)"
"man strftime) (note: content is evaluated, see /help eval)"
msgstr ""
"chemin pour les fichiers de log WeeChat ; \"%h\" au début de la chaîne est "
"remplacé par le répertoire de base WeeChat (par défaut : \"~/.weechat\") ; "
"les caractères de formatage de date sont autorisés (voir man strftime)"
"les caractères de formatage de date sont autorisés (voir man strftime) "
"(note : le contenu est évalué, voir /help eval)"
msgid ""
"replacement char for special chars in filename built with mask (like "
+2 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-19 21:06+0200\n"
"POT-Creation-Date: 2015-06-20 08:05+0200\n"
"PO-Revision-Date: 2015-03-21 08:41+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -7981,7 +7981,7 @@ msgstr ""
msgid ""
"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
"man strftime)"
"man strftime) (note: content is evaluated, see /help eval)"
msgstr ""
"modulok elérési útvonala ('%h' helyére automatikusan a WeeChat saját "
"könyvtára, alapértelmezésben ~/.weechat, kerül)"
+3 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-19 21:06+0200\n"
"POT-Creation-Date: 2015-06-20 08:05+0200\n"
"PO-Revision-Date: 2015-03-21 08:41+0100\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -9056,10 +9056,11 @@ msgid "text to write after nick in prefix of message, example: \">\""
msgstr ""
"testo da scrivere dopo il nick nel prefisso del messaggo, esempio: \"<\""
#, fuzzy
msgid ""
"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
"man strftime)"
"man strftime) (note: content is evaluated, see /help eval)"
msgstr ""
"path per i file di log di WeeChat: \"%h\" all'inizio della stringa viene "
"sostituito dalla directory home di WeeChat (predefinita è \"~/.weechat); "
+3 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-19 21:06+0200\n"
"POT-Creation-Date: 2015-06-20 08:05+0200\n"
"PO-Revision-Date: 2015-06-09 22:28+0900\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/translation_ja>\n"
@@ -9206,10 +9206,11 @@ msgstr "ニックネームの前に書くテキスト (メッセージプレフ
msgid "text to write after nick in prefix of message, example: \">\""
msgstr "ニックネームの後に書くテキスト (メッセージプレフィックス)、例: \">\""
#, fuzzy
msgid ""
"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
"man strftime)"
"man strftime) (note: content is evaluated, see /help eval)"
msgstr ""
"WeeChat ログファイルのパス; 文字列最初の \"%h\" は WeeChat ホーム (デフォルト"
"では \"~/.weechat\") に置換; 日付指定子を使える (strftime の man を参照)"
+3 -2
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-19 21:06+0200\n"
"POT-Creation-Date: 2015-06-20 08:05+0200\n"
"PO-Revision-Date: 2015-05-09 14:00+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -9394,10 +9394,11 @@ msgstr ""
msgid "text to write after nick in prefix of message, example: \">\""
msgstr "tekst wyświetlany za nickiem w przedrostku wiadomości, przykład: \">\""
#, fuzzy
msgid ""
"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
"man strftime)"
"man strftime) (note: content is evaluated, see /help eval)"
msgstr ""
"ścieżka do plików z logami WeeChat; \"%h\" na początku ciągu zostanie "
"zastąpione przez katalog domowy WeeChat (domyślnie \"~/.weechat\"); "
+3 -2
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-19 21:06+0200\n"
"POT-Creation-Date: 2015-06-20 08:05+0200\n"
"PO-Revision-Date: 2015-03-21 08:41+0100\n"
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -8399,10 +8399,11 @@ msgstr ""
msgid "text to write after nick in prefix of message, example: \">\""
msgstr ""
#, fuzzy
msgid ""
"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
"man strftime)"
"man strftime) (note: content is evaluated, see /help eval)"
msgstr ""
"diretório para arquivos de registro do WeeChat; \"%h\" no início da string "
"será substituído pelo diretório do WeeChat (\"~/.weechat\" por padrão); "
+2 -2
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-19 21:06+0200\n"
"POT-Creation-Date: 2015-06-20 08:05+0200\n"
"PO-Revision-Date: 2015-03-21 08:41+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -8010,7 +8010,7 @@ msgstr ""
msgid ""
"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
"man strftime)"
"man strftime) (note: content is evaluated, see /help eval)"
msgstr ""
"путь поиска pluginов ('%h' заменяется на домашний каталог WeeChat, по "
"умолчанию - ~/.weechat)"
+2 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-19 21:06+0200\n"
"POT-Creation-Date: 2015-06-20 08:05+0200\n"
"PO-Revision-Date: 2015-03-10 21:33+0100\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -7218,7 +7218,7 @@ msgstr ""
msgid ""
"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
"man strftime)"
"man strftime) (note: content is evaluated, see /help eval)"
msgstr ""
msgid ""
+2 -2
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-19 21:06+0200\n"
"POT-Creation-Date: 2015-06-20 08:05+0200\n"
"PO-Revision-Date: 2014-08-16 10:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -7153,7 +7153,7 @@ msgstr ""
msgid ""
"path for WeeChat log files; \"%h\" at beginning of string is replaced by "
"WeeChat home (\"~/.weechat\" by default); date specifiers are permitted (see "
"man strftime)"
"man strftime) (note: content is evaluated, see /help eval)"
msgstr ""
msgid ""
+2 -1
View File
@@ -470,7 +470,8 @@ logger_config_init ()
"path", "string",
N_("path for WeeChat log files; \"%h\" at beginning of string is "
"replaced by WeeChat home (\"~/.weechat\" by default); date "
"specifiers are permitted (see man strftime)"),
"specifiers are permitted (see man strftime) "
"(note: content is evaluated, see /help eval)"),
NULL, 0, 0, "%h/logs/", NULL, 0, NULL, NULL,
&logger_config_change_file_option_restart_log, NULL, NULL, NULL);
logger_config_file_replacement_char = weechat_config_new_option (
+29 -20
View File
@@ -71,7 +71,7 @@ struct t_hook *logger_timer = NULL; /* timer to flush log files */
char *
logger_get_file_path ()
{
char *file_path, *file_path2, *file_path3;
char *file_path, *file_path2, *file_path3, *file_path4;
const char *weechat_dir;
int length;
time_t seconds;
@@ -80,45 +80,52 @@ logger_get_file_path ()
file_path = NULL;
file_path2 = NULL;
file_path3 = NULL;
file_path4 = NULL;
weechat_dir = weechat_info_get ("weechat_dir", "");
if (!weechat_dir)
goto end;
/* replace "~" with user home */
file_path = weechat_string_expand_home (weechat_config_string (logger_config_file_path));
/* evaluate path */
file_path = weechat_string_eval_expression (
weechat_config_string (logger_config_file_path), NULL, NULL, NULL);
if (!file_path)
goto end;
/* replace "%h" with WeeChat home (at beginning of string only) */
if (strncmp (file_path, "%h", 2) == 0)
{
length = strlen (weechat_dir) + strlen (file_path + 2) + 1;
file_path2 = malloc (length);
if (file_path2)
snprintf (file_path2, length, "%s%s", weechat_dir, file_path + 2);
}
else
file_path2 = strdup (file_path);
/* replace "~" with user home */
file_path2 = weechat_string_expand_home (file_path);
if (!file_path2)
goto end;
/* replace date/time specifiers in path */
length = strlen (file_path2) + 256 + 1;
file_path3 = malloc (length);
/* replace "%h" with WeeChat home (at beginning of string only) */
if (strncmp (file_path2, "%h", 2) == 0)
{
length = strlen (weechat_dir) + strlen (file_path2 + 2) + 1;
file_path3 = malloc (length);
if (file_path3)
snprintf (file_path3, length, "%s%s", weechat_dir, file_path2 + 2);
}
else
file_path3 = strdup (file_path2);
if (!file_path3)
goto end;
/* replace date/time specifiers in path */
length = strlen (file_path3) + 256 + 1;
file_path4 = malloc (length);
if (!file_path4)
goto end;
seconds = time (NULL);
date_tmp = localtime (&seconds);
file_path3[0] = '\0';
strftime (file_path3, length - 1, file_path2, date_tmp);
file_path4[0] = '\0';
strftime (file_path4, length - 1, file_path3, date_tmp);
if (weechat_logger_plugin->debug)
{
weechat_printf_tags (NULL,
"no_log",
"%s: file path = \"%s\"",
LOGGER_PLUGIN_NAME, file_path3);
LOGGER_PLUGIN_NAME, file_path4);
}
end:
@@ -126,8 +133,10 @@ end:
free (file_path);
if (file_path2)
free (file_path2);
if (file_path3)
free (file_path3);
return file_path3;
return file_path4;
}
/*