diff options
-rw-r--r-- | ChangeLog.adoc | 1 | ||||
-rw-r--r-- | doc/de/autogen/user/logger_options.adoc | 8 | ||||
-rw-r--r-- | doc/en/autogen/user/logger_options.adoc | 8 | ||||
-rw-r--r-- | doc/fr/autogen/user/logger_options.adoc | 8 | ||||
-rw-r--r-- | doc/it/autogen/user/logger_options.adoc | 8 | ||||
-rw-r--r-- | doc/ja/autogen/user/logger_options.adoc | 8 | ||||
-rw-r--r-- | doc/pl/autogen/user/logger_options.adoc | 8 | ||||
-rw-r--r-- | po/cs.po | 18 | ||||
-rw-r--r-- | po/de.po | 16 | ||||
-rw-r--r-- | po/es.po | 16 | ||||
-rw-r--r-- | po/fr.po | 22 | ||||
-rw-r--r-- | po/hu.po | 18 | ||||
-rw-r--r-- | po/it.po | 16 | ||||
-rw-r--r-- | po/ja.po | 16 | ||||
-rw-r--r-- | po/pl.po | 16 | ||||
-rw-r--r-- | po/pt.po | 16 | ||||
-rw-r--r-- | po/pt_BR.po | 18 | ||||
-rw-r--r-- | po/ru.po | 18 | ||||
-rw-r--r-- | po/tr.po | 11 | ||||
-rw-r--r-- | po/weechat.pot | 11 | ||||
-rw-r--r-- | src/plugins/logger/logger-backlog.c | 51 | ||||
-rw-r--r-- | src/plugins/logger/logger-config.c | 51 | ||||
-rw-r--r-- | src/plugins/logger/logger-config.h | 3 | ||||
-rw-r--r-- | src/plugins/logger/logger.c | 94 | ||||
-rw-r--r-- | src/plugins/logger/logger.h | 8 |
25 files changed, 361 insertions, 107 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 0489448b3..482d0a29a 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -25,6 +25,7 @@ New features:: * api: add modifier "color_encode_ansi" (issue #528) * irc: add "user" in output of irc_message_parse (issue #136) * irc: add options irc.color.message_kick and irc.color.reason_kick (issue #683, issue #684) + * logger: add option logger.file.color_lines (issue #528, issue #621) * script: add options "-ol" and "-il" in command /script to send translated string with list of scripts loaded, display "No scripts loaded" if no scripts are loaded Bug fixes:: diff --git a/doc/de/autogen/user/logger_options.adoc b/doc/de/autogen/user/logger_options.adoc index c9286b748..3b7f4b40b 100644 --- a/doc/de/autogen/user/logger_options.adoc +++ b/doc/de/autogen/user/logger_options.adoc @@ -9,7 +9,7 @@ ** Standardwert: `+default+` * [[option_logger.color.backlog_line]] *logger.color.backlog_line* -** Beschreibung: pass:none[Textfarbe in der der Verlaufsspeicher dargestellt werden soll] +** Beschreibung: pass:none[color for backlog lines, used only if the option logger.file.color_lines is off] ** Typ: Farbe ** Werte: ein Farbname für WeeChat (default, black, (dark)gray, white, (light)red, (light)green, brown, yellow, (light)blue, (light)magenta, (light)cyan), eine Terminal-Farbnummer oder ein Alias; Attribute können vor eine Farbe gesetzt werden (gilt ausschließlich für die Textfarbe und nicht für den Hintergrund): "*" für fett, "!" für invertiert, "/" für kursiv, "_" für unterstrichen ** Standardwert: `+default+` @@ -20,6 +20,12 @@ ** Werte: on, off ** Standardwert: `+on+` +* [[option_logger.file.color_lines]] *logger.file.color_lines* +** Beschreibung: pass:none[use ANSI color codes in lines written in log files and display backlog lines with these colors] +** Typ: boolesch +** Werte: on, off +** Standardwert: `+off+` + * [[option_logger.file.flush_delay]] *logger.file.flush_delay* ** Beschreibung: pass:none[Zeit, in Sekunden, die verstreicht bis eine Protokolldatei gesichert wird (0 = Protokolldatei wird unmittelbar gesichert, nachdem eine neue Zeile dargestellt wurde)] ** Typ: integer diff --git a/doc/en/autogen/user/logger_options.adoc b/doc/en/autogen/user/logger_options.adoc index 0a39c5aa2..420dd1811 100644 --- a/doc/en/autogen/user/logger_options.adoc +++ b/doc/en/autogen/user/logger_options.adoc @@ -9,7 +9,7 @@ ** default value: `+default+` * [[option_logger.color.backlog_line]] *logger.color.backlog_line* -** description: pass:none[color for backlog lines] +** description: pass:none[color for backlog lines, used only if the option logger.file.color_lines is off] ** type: color ** values: a WeeChat color name (default, black, (dark)gray, white, (light)red, (light)green, brown, yellow, (light)blue, (light)magenta, (light)cyan), a terminal color number or an alias; attributes are allowed before color (for text color only, not background): "*" for bold, "!" for reverse, "/" for italic, "_" for underline ** default value: `+default+` @@ -20,6 +20,12 @@ ** values: on, off ** default value: `+on+` +* [[option_logger.file.color_lines]] *logger.file.color_lines* +** description: pass:none[use ANSI color codes in lines written in log files and display backlog lines with these colors] +** type: boolean +** values: on, off +** default value: `+off+` + * [[option_logger.file.flush_delay]] *logger.file.flush_delay* ** description: pass:none[number of seconds between flush of log files (0 = write in log files immediately for each line printed)] ** type: integer diff --git a/doc/fr/autogen/user/logger_options.adoc b/doc/fr/autogen/user/logger_options.adoc index c93be11f5..1f41b244f 100644 --- a/doc/fr/autogen/user/logger_options.adoc +++ b/doc/fr/autogen/user/logger_options.adoc @@ -9,7 +9,7 @@ ** valeur par défaut: `+default+` * [[option_logger.color.backlog_line]] *logger.color.backlog_line* -** description: pass:none[couleur pour les lignes de l'historique] +** description: pass:none[couleur pour les lignes de l'historique, utilisée seulement si l'option logger.file.color_lines est désactivée] ** type: couleur ** valeurs: un nom de couleur WeeChat (default, black, (dark)gray, white, (light)red, (light)green, brown, yellow, (light)blue, (light)magenta, (light)cyan), un numéro de couleur du terminal ou un alias ; des attributs sont autorisés avant la couleur (seulement pour la couleur du texte, pas le fond) : "*" pour le gras, "!" pour la vidéo inverse, "/" pour l'italique, "_" pour le souligné ** valeur par défaut: `+default+` @@ -20,6 +20,12 @@ ** valeurs: on, off ** valeur par défaut: `+on+` +* [[option_logger.file.color_lines]] *logger.file.color_lines* +** description: pass:none[utiliser des codes de couleurs ANSI dans les lignes écrites dans les fichiers de log et afficher les lignes de l'historique avec ces couleurs] +** type: booléen +** valeurs: on, off +** valeur par défaut: `+off+` + * [[option_logger.file.flush_delay]] *logger.file.flush_delay* ** description: pass:none[nombre de secondes entre les "flush" (écriture) dans les fichiers de log (0 = écrire immédiatement dans les fichiers de log pour chaque ligne affichée)] ** type: entier diff --git a/doc/it/autogen/user/logger_options.adoc b/doc/it/autogen/user/logger_options.adoc index 3519f52b6..9aa8db902 100644 --- a/doc/it/autogen/user/logger_options.adoc +++ b/doc/it/autogen/user/logger_options.adoc @@ -9,7 +9,7 @@ ** valore predefinito: `+default+` * [[option_logger.color.backlog_line]] *logger.color.backlog_line* -** descrizione: pass:none[colore per la cronologia] +** descrizione: pass:none[color for backlog lines, used only if the option logger.file.color_lines is off] ** tipo: colore ** valori: a WeeChat color name (default, black, (dark)gray, white, (light)red, (light)green, brown, yellow, (light)blue, (light)magenta, (light)cyan), a terminal color number or an alias; attributes are allowed before color (for text color only, not background): "*" for bold, "!" for reverse, "/" for italic, "_" for underline ** valore predefinito: `+default+` @@ -20,6 +20,12 @@ ** valori: on, off ** valore predefinito: `+on+` +* [[option_logger.file.color_lines]] *logger.file.color_lines* +** descrizione: pass:none[use ANSI color codes in lines written in log files and display backlog lines with these colors] +** tipo: bool +** valori: on, off +** valore predefinito: `+off+` + * [[option_logger.file.flush_delay]] *logger.file.flush_delay* ** descrizione: pass:none[numero di secondi tra il flush (scrittura) dei file di log (0 = scrive sui file di log immediatamente per ogni riga stampata)] ** tipo: intero diff --git a/doc/ja/autogen/user/logger_options.adoc b/doc/ja/autogen/user/logger_options.adoc index a70096d70..b3009f4bf 100644 --- a/doc/ja/autogen/user/logger_options.adoc +++ b/doc/ja/autogen/user/logger_options.adoc @@ -9,7 +9,7 @@ ** デフォルト値: `+default+` * [[option_logger.color.backlog_line]] *logger.color.backlog_line* -** 説明: pass:none[バックログ行の色] +** 説明: pass:none[color for backlog lines, used only if the option logger.file.color_lines is off] ** タイプ: 色 ** 値: WeeChat の色名 (default、black、(dark)gray、white、(light)red、(light)green、brown、yellow、(light)blue、(light)magenta、(light)cyan) 、端末色番号またはその別名; 色の前に属性を置くことができます (テキスト前景色のみ、背景色は出来ません): 太字は "*"、反転は "!"、イタリックは "/"、下線は "_" ** デフォルト値: `+default+` @@ -20,6 +20,12 @@ ** 値: on, off ** デフォルト値: `+on+` +* [[option_logger.file.color_lines]] *logger.file.color_lines* +** 説明: pass:none[use ANSI color codes in lines written in log files and display backlog lines with these colors] +** タイプ: ブール +** 値: on, off +** デフォルト値: `+off+` + * [[option_logger.file.flush_delay]] *logger.file.flush_delay* ** 説明: pass:none[ログファイルをフラッシュする間隔の秒数 (0 = 行が表示されたらすぐにログファイルに書き込み)] ** タイプ: 整数 diff --git a/doc/pl/autogen/user/logger_options.adoc b/doc/pl/autogen/user/logger_options.adoc index 6253366ef..d7844ef3d 100644 --- a/doc/pl/autogen/user/logger_options.adoc +++ b/doc/pl/autogen/user/logger_options.adoc @@ -9,7 +9,7 @@ ** domyślna wartość: `+default+` * [[option_logger.color.backlog_line]] *logger.color.backlog_line* -** opis: pass:none[kolor linii backloga] +** opis: pass:none[color for backlog lines, used only if the option logger.file.color_lines is off] ** typ: kolor ** wartości: nazwa koloru WeeChat (default, black, (dark)gray, white, (light)red, (light)green, brown, yellow, (light)blue, (light)magenta, (light)cyan), numer koloru terminala albo alias; atrybuty dozwolone przed kolorem (tylko dla kolorów testu, nie tła): "*" pogrubienie, "!" odwrócenie, "/" pochylenie, "_" podkreślenie ** domyślna wartość: `+default+` @@ -20,6 +20,12 @@ ** wartości: on, off ** domyślna wartość: `+on+` +* [[option_logger.file.color_lines]] *logger.file.color_lines* +** opis: pass:none[use ANSI color codes in lines written in log files and display backlog lines with these colors] +** typ: bool +** wartości: on, off +** domyślna wartość: `+off+` + * [[option_logger.file.flush_delay]] *logger.file.flush_delay* ** opis: pass:none[ilość sekund pomiędzy zapisywaniem plików z logami (0 = zapisuj pliki natychmiast po pojawieniu sie każdej nowej linii)] ** typ: liczba @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2019-09-27 18:18+0200\n" +"POT-Creation-Date: 2019-10-02 20:42+0200\n" "PO-Revision-Date: 2019-05-13 21:31+0200\n" "Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -9856,9 +9856,10 @@ msgstr "" msgid "color for line ending the backlog" msgstr "barva textu pro akce ve vstupní řádce" -#, fuzzy -msgid "color for backlog lines" -msgstr "barva položek, které jsou pryč" +msgid "" +"color for backlog lines, used only if the option logger.file.color_lines is " +"off" +msgstr "" msgid "" "automatically save content of buffers to files (unless a buffer disables log)" @@ -9867,6 +9868,11 @@ msgstr "" "bufferu)" msgid "" +"use ANSI color codes in lines written in log files and display backlog lines " +"with these colors" +msgstr "" + +msgid "" "number of seconds between flush of log files (0 = write in log files " "immediately for each line printed)" msgstr "" @@ -12911,3 +12917,7 @@ msgstr "%s%s: vypršel časový limit \"%s\" pro %s" #, c-format msgid "%s%s: unable to connect: unexpected error (%d)" msgstr "%s%s: nemohu se připojit\" neočekávaná chyba (%d)" + +#, fuzzy +#~ msgid "color for backlog lines" +#~ msgstr "barva položek, které jsou pryč" @@ -24,7 +24,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2019-09-27 18:18+0200\n" +"POT-Creation-Date: 2019-10-02 20:42+0200\n" "PO-Revision-Date: 2019-09-28 14:39+0200\n" "Last-Translator: Nils Görs <weechatter@arcor.de>\n" "Language-Team: German <kde-i18n-de@kde.org>\n" @@ -11685,8 +11685,10 @@ msgstr "" msgid "color for line ending the backlog" msgstr "Farbe für die letzte Zeile im Verlaufsspeicher" -msgid "color for backlog lines" -msgstr "Textfarbe in der der Verlaufsspeicher dargestellt werden soll" +msgid "" +"color for backlog lines, used only if the option logger.file.color_lines is " +"off" +msgstr "" msgid "" "automatically save content of buffers to files (unless a buffer disables log)" @@ -11695,6 +11697,11 @@ msgstr "" "Protokollieren für den Buffer nicht deaktiviert sein sollte)" msgid "" +"use ANSI color codes in lines written in log files and display backlog lines " +"with these colors" +msgstr "" + +msgid "" "number of seconds between flush of log files (0 = write in log files " "immediately for each line printed)" msgstr "" @@ -15088,3 +15095,6 @@ msgstr "%s%s: Zeitüberschreitung für \"%s\" mit %s" msgid "%s%s: unable to connect: unexpected error (%d)" msgstr "" "%s%s: Verbindung konnte nicht hergestellt werden: unerwarteter Fehler (%d)" + +#~ msgid "color for backlog lines" +#~ msgstr "Textfarbe in der der Verlaufsspeicher dargestellt werden soll" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2019-09-27 18:18+0200\n" +"POT-Creation-Date: 2019-10-02 20:42+0200\n" "PO-Revision-Date: 2019-05-13 21:31+0200\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -10172,8 +10172,10 @@ msgstr "" msgid "color for line ending the backlog" msgstr "color para el final de línea del último registro" -msgid "color for backlog lines" -msgstr "color para las líneas del último registro" +msgid "" +"color for backlog lines, used only if the option logger.file.color_lines is " +"off" +msgstr "" msgid "" "automatically save content of buffers to files (unless a buffer disables log)" @@ -10182,6 +10184,11 @@ msgstr "" "el buffer desactive el registro)" msgid "" +"use ANSI color codes in lines written in log files and display backlog lines " +"with these colors" +msgstr "" + +msgid "" "number of seconds between flush of log files (0 = write in log files " "immediately for each line printed)" msgstr "" @@ -13194,3 +13201,6 @@ msgstr "%s%s: tiempo de espera máximo para \"%s\" con %s" #, fuzzy, c-format msgid "%s%s: unable to connect: unexpected error (%d)" msgstr "%s%s: no es posible conectarse al transmisor" + +#~ msgid "color for backlog lines" +#~ msgstr "color para las líneas del último registro" @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2019-09-27 18:18+0200\n" -"PO-Revision-Date: 2019-09-30 21:41+0200\n" +"POT-Creation-Date: 2019-10-02 20:42+0200\n" +"PO-Revision-Date: 2019-10-02 20:43+0200\n" "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language: fr\n" @@ -11408,8 +11408,12 @@ msgstr "" msgid "color for line ending the backlog" msgstr "couleur pour la ligne de fin de l'historique" -msgid "color for backlog lines" -msgstr "couleur pour les lignes de l'historique" +msgid "" +"color for backlog lines, used only if the option logger.file.color_lines is " +"off" +msgstr "" +"couleur pour les lignes de l'historique, utilisée seulement si l'option " +"logger.file.color_lines est désactivée" msgid "" "automatically save content of buffers to files (unless a buffer disables log)" @@ -11418,6 +11422,13 @@ msgstr "" "tampon désactive le log)" msgid "" +"use ANSI color codes in lines written in log files and display backlog lines " +"with these colors" +msgstr "" +"utiliser des codes de couleurs ANSI dans les lignes écrites dans les " +"fichiers de log et afficher les lignes de l'historique avec ces couleurs" + +msgid "" "number of seconds between flush of log files (0 = write in log files " "immediately for each line printed)" msgstr "" @@ -14782,3 +14793,6 @@ msgstr "%s%s : délai d'attente dépassé pour \"%s\" avec %s" #, c-format msgid "%s%s: unable to connect: unexpected error (%d)" msgstr "%s%s : impossible de se connecter : erreur inattendue (%d)" + +#~ msgid "color for backlog lines" +#~ msgstr "couleur pour les lignes de l'historique" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2019-09-27 18:18+0200\n" +"POT-Creation-Date: 2019-10-02 20:42+0200\n" "PO-Revision-Date: 2019-05-13 21:31+0200\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -9210,15 +9210,21 @@ msgstr "" msgid "color for line ending the backlog" msgstr "nevek színe" -#, fuzzy -msgid "color for backlog lines" -msgstr "távollevő felhasználók nevének színe" +msgid "" +"color for backlog lines, used only if the option logger.file.color_lines is " +"off" +msgstr "" msgid "" "automatically save content of buffers to files (unless a buffer disables log)" msgstr "" msgid "" +"use ANSI color codes in lines written in log files and display backlog lines " +"with these colors" +msgstr "" + +msgid "" "number of seconds between flush of log files (0 = write in log files " "immediately for each line printed)" msgstr "" @@ -12166,3 +12172,7 @@ msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n" #, fuzzy, c-format msgid "%s%s: unable to connect: unexpected error (%d)" msgstr "%s DCC: nem sikerült kapcsolódni a küldőhöz\n" + +#, fuzzy +#~ msgid "color for backlog lines" +#~ msgstr "távollevő felhasználók nevének színe" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2019-09-27 18:18+0200\n" +"POT-Creation-Date: 2019-10-02 20:42+0200\n" "PO-Revision-Date: 2019-05-13 21:31+0200\n" "Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -10353,8 +10353,10 @@ msgstr "" msgid "color for line ending the backlog" msgstr "colore per la riga finale nella cronologia" -msgid "color for backlog lines" -msgstr "colore per la cronologia" +msgid "" +"color for backlog lines, used only if the option logger.file.color_lines is " +"off" +msgstr "" msgid "" "automatically save content of buffers to files (unless a buffer disables log)" @@ -10363,6 +10365,11 @@ msgstr "" "disabiliti il log)" msgid "" +"use ANSI color codes in lines written in log files and display backlog lines " +"with these colors" +msgstr "" + +msgid "" "number of seconds between flush of log files (0 = write in log files " "immediately for each line printed)" msgstr "" @@ -13414,3 +13421,6 @@ msgstr "%s%s: timeout per \"%s\" con %s" #, fuzzy, c-format msgid "%s%s: unable to connect: unexpected error (%d)" msgstr "%s%s: impossibile connettersi al mittente" + +#~ msgid "color for backlog lines" +#~ msgstr "colore per la cronologia" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2019-09-27 18:18+0200\n" +"POT-Creation-Date: 2019-10-02 20:42+0200\n" "PO-Revision-Date: 2019-09-22 18:54+0200\n" "Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n" "Language-Team: Japanese <https://github.com/l/weechat/tree/master/" @@ -10983,8 +10983,10 @@ msgstr "" msgid "color for line ending the backlog" msgstr "バックログの最終行の色" -msgid "color for backlog lines" -msgstr "バックログ行の色" +msgid "" +"color for backlog lines, used only if the option logger.file.color_lines is " +"off" +msgstr "" msgid "" "automatically save content of buffers to files (unless a buffer disables log)" @@ -10993,6 +10995,11 @@ msgstr "" "い限り)" msgid "" +"use ANSI color codes in lines written in log files and display backlog lines " +"with these colors" +msgstr "" + +msgid "" "number of seconds between flush of log files (0 = write in log files " "immediately for each line printed)" msgstr "" @@ -14202,3 +14209,6 @@ msgstr "%s%s: \"%s\" のタイムアウト %s" #, c-format msgid "%s%s: unable to connect: unexpected error (%d)" msgstr "%s%s: 接続できません: 未定義のエラー (%d)" + +#~ msgid "color for backlog lines" +#~ msgstr "バックログ行の色" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2019-09-27 18:18+0200\n" +"POT-Creation-Date: 2019-10-02 20:42+0200\n" "PO-Revision-Date: 2019-09-22 18:54+0200\n" "Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n" "Language-Team: Polish <kde-i18n-doc@kde.org>\n" @@ -11152,8 +11152,10 @@ msgstr "" msgid "color for line ending the backlog" msgstr "kolor linii kończącej backloga" -msgid "color for backlog lines" -msgstr "kolor linii backloga" +msgid "" +"color for backlog lines, used only if the option logger.file.color_lines is " +"off" +msgstr "" msgid "" "automatically save content of buffers to files (unless a buffer disables log)" @@ -11162,6 +11164,11 @@ msgstr "" "wyłączone logowanie)" msgid "" +"use ANSI color codes in lines written in log files and display backlog lines " +"with these colors" +msgstr "" + +msgid "" "number of seconds between flush of log files (0 = write in log files " "immediately for each line printed)" msgstr "" @@ -14436,3 +14443,6 @@ msgstr "%s%s: przekroczono czas na \"%s\" z %s" #, c-format msgid "%s%s: unable to connect: unexpected error (%d)" msgstr "%s%s: nie można połączyć: niespodziewany błąd (%d)" + +#~ msgid "color for backlog lines" +#~ msgstr "kolor linii backloga" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2019-09-27 18:18+0200\n" +"POT-Creation-Date: 2019-10-02 20:42+0200\n" "PO-Revision-Date: 2019-09-22 18:54+0200\n" "Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n" "Language-Team: Portuguese <>\n" @@ -10817,8 +10817,10 @@ msgstr "" msgid "color for line ending the backlog" msgstr "cor da linha que termina o registo recente" -msgid "color for backlog lines" -msgstr "cor das linhas do registo recente" +msgid "" +"color for backlog lines, used only if the option logger.file.color_lines is " +"off" +msgstr "" msgid "" "automatically save content of buffers to files (unless a buffer disables log)" @@ -10827,6 +10829,11 @@ msgstr "" "buffer tenha registo desativado)" msgid "" +"use ANSI color codes in lines written in log files and display backlog lines " +"with these colors" +msgstr "" + +msgid "" "number of seconds between flush of log files (0 = write in log files " "immediately for each line printed)" msgstr "" @@ -14073,3 +14080,6 @@ msgstr "%s%s: tempo limite de \"%s\" com %s" #, c-format msgid "%s%s: unable to connect: unexpected error (%d)" msgstr "%s%s: não foi possível conectar: erro inesperado (%d)" + +#~ msgid "color for backlog lines" +#~ msgstr "cor das linhas do registo recente" diff --git a/po/pt_BR.po b/po/pt_BR.po index 506752b37..e6a1c77a9 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2019-09-27 18:18+0200\n" +"POT-Creation-Date: 2019-10-02 20:42+0200\n" "PO-Revision-Date: 2019-05-13 21:32+0200\n" "Last-Translator: Eduardo Elias <camponez@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -9658,9 +9658,10 @@ msgstr "" msgid "color for line ending the backlog" msgstr "cor para o apelido na barra de entrada" -#, fuzzy -msgid "color for backlog lines" -msgstr "cor de texto para valores" +msgid "" +"color for backlog lines, used only if the option logger.file.color_lines is " +"off" +msgstr "" msgid "" "automatically save content of buffers to files (unless a buffer disables log)" @@ -9669,6 +9670,11 @@ msgstr "" "buffer desabilitar o registro)" msgid "" +"use ANSI color codes in lines written in log files and display backlog lines " +"with these colors" +msgstr "" + +msgid "" "number of seconds between flush of log files (0 = write in log files " "immediately for each line printed)" msgstr "" @@ -12643,3 +12649,7 @@ msgstr "%s%s: tempo esgotado para \"%s\" com %s" #, fuzzy, c-format msgid "%s%s: unable to connect: unexpected error (%d)" msgstr "%s%s: não foi possível conectar ao remetente" + +#, fuzzy +#~ msgid "color for backlog lines" +#~ msgstr "cor de texto para valores" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2019-09-27 18:18+0200\n" +"POT-Creation-Date: 2019-10-02 20:42+0200\n" "PO-Revision-Date: 2019-05-13 21:32+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -9246,15 +9246,21 @@ msgstr "" msgid "color for line ending the backlog" msgstr "цвет ников" -#, fuzzy -msgid "color for backlog lines" -msgstr "цвет отошедших ников" +msgid "" +"color for backlog lines, used only if the option logger.file.color_lines is " +"off" +msgstr "" msgid "" "automatically save content of buffers to files (unless a buffer disables log)" msgstr "" msgid "" +"use ANSI color codes in lines written in log files and display backlog lines " +"with these colors" +msgstr "" + +msgid "" "number of seconds between flush of log files (0 = write in log files " "immediately for each line printed)" msgstr "" @@ -12198,3 +12204,7 @@ msgstr "%s нет аргумента для параметра \"%s\"\n" #, fuzzy, c-format msgid "%s%s: unable to connect: unexpected error (%d)" msgstr "%s DCC: не могу соединиться с отправителем\n" + +#, fuzzy +#~ msgid "color for backlog lines" +#~ msgstr "цвет отошедших ников" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2019-09-27 18:18+0200\n" +"POT-Creation-Date: 2019-10-02 20:42+0200\n" "PO-Revision-Date: 2019-05-13 21:32+0200\n" "Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -8413,7 +8413,9 @@ msgstr "" msgid "color for line ending the backlog" msgstr "" -msgid "color for backlog lines" +msgid "" +"color for backlog lines, used only if the option logger.file.color_lines is " +"off" msgstr "" msgid "" @@ -8421,6 +8423,11 @@ msgid "" msgstr "" msgid "" +"use ANSI color codes in lines written in log files and display backlog lines " +"with these colors" +msgstr "" + +msgid "" "number of seconds between flush of log files (0 = write in log files " "immediately for each line printed)" msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index 1fd9eb5b3..52f47b916 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2019-09-27 18:18+0200\n" +"POT-Creation-Date: 2019-10-02 20:42+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" @@ -8275,7 +8275,9 @@ msgstr "" msgid "color for line ending the backlog" msgstr "" -msgid "color for backlog lines" +msgid "" +"color for backlog lines, used only if the option logger.file.color_lines is " +"off" msgstr "" msgid "" @@ -8283,6 +8285,11 @@ msgid "" msgstr "" msgid "" +"use ANSI color codes in lines written in log files and display backlog lines " +"with these colors" +msgstr "" + +msgid "" "number of seconds between flush of log files (0 = write in log files " "immediately for each line printed)" msgstr "" diff --git a/src/plugins/logger/logger-backlog.c b/src/plugins/logger/logger-backlog.c index bfd3c022c..f1ff70aa1 100644 --- a/src/plugins/logger/logger-backlog.c +++ b/src/plugins/logger/logger-backlog.c @@ -110,13 +110,15 @@ void logger_backlog (struct t_gui_buffer *buffer, const char *filename, int lines) { struct t_logger_line *last_lines, *ptr_lines; - char *charset, *pos_message, *pos_tab, *error, *message; + char *charset, *pos_message, *pos_tab, *error, *message, *message2; time_t datetime, time_now; struct tm tm_line; - int num_lines; + int color_lines, num_lines; weechat_buffer_set (buffer, "print_hooks_enabled", "0"); + color_lines = weechat_config_boolean (logger_config_file_color_lines); + num_lines = 0; last_lines = logger_tail_file (filename, lines); ptr_lines = last_lines; @@ -145,26 +147,35 @@ logger_backlog (struct t_gui_buffer *buffer, const char *filename, int lines) } pos_message = (pos_message && (datetime != 0)) ? pos_message + 1 : ptr_lines->data; - charset = weechat_info_get ("charset_terminal", ""); - message = (charset) ? - weechat_iconv_to_internal (charset, pos_message) : strdup (pos_message); - if (charset) - free (charset); + message = weechat_hook_modifier_exec ( + "color_decode_ansi", + (color_lines) ? "1" : "0", + pos_message); if (message) { - pos_tab = strchr (message, '\t'); - if (pos_tab) - pos_tab[0] = '\0'; - weechat_printf_date_tags (buffer, datetime, - "no_highlight,notify_none,logger_backlog", - "%s%s%s%s%s", - weechat_color (weechat_config_string (logger_config_color_backlog_line)), - message, - (pos_tab) ? "\t" : "", - (pos_tab) ? weechat_color (weechat_config_string (logger_config_color_backlog_line)) : "", - (pos_tab) ? pos_tab + 1 : ""); - if (pos_tab) - pos_tab[0] = '\t'; + charset = weechat_info_get ("charset_terminal", ""); + message2 = (charset) ? + weechat_iconv_to_internal (charset, message) : strdup (message); + if (charset) + free (charset); + if (message2) + { + pos_tab = strchr (message2, '\t'); + if (pos_tab) + pos_tab[0] = '\0'; + weechat_printf_date_tags ( + buffer, datetime, + "no_highlight,notify_none,logger_backlog", + "%s%s%s%s%s", + (color_lines) ? "" : weechat_color (weechat_config_string (logger_config_color_backlog_line)), + message2, + (pos_tab) ? "\t" : "", + (pos_tab && !color_lines) ? weechat_color (weechat_config_string (logger_config_color_backlog_line)) : "", + (pos_tab) ? pos_tab + 1 : ""); + if (pos_tab) + pos_tab[0] = '\t'; + free (message2); + } free (message); } num_lines++; diff --git a/src/plugins/logger/logger-config.c b/src/plugins/logger/logger-config.c index c2fae6909..e0dbaecbf 100644 --- a/src/plugins/logger/logger-config.c +++ b/src/plugins/logger/logger-config.c @@ -46,6 +46,7 @@ struct t_config_option *logger_config_color_backlog_line; /* logger config, file section */ struct t_config_option *logger_config_file_auto_log; +struct t_config_option *logger_config_file_color_lines; struct t_config_option *logger_config_file_flush_delay; struct t_config_option *logger_config_file_fsync; struct t_config_option *logger_config_file_info_lines; @@ -77,6 +78,31 @@ logger_config_change_file_option_restart_log (const void *pointer, void *data, } /* + * Callback for changes on option "logger.file.color_lines". + */ + +void +logger_config_color_lines_change (const void *pointer, void *data, + struct t_config_option *option) +{ + /* make C compiler happy */ + (void) pointer; + (void) data; + (void) option; + + if (logger_config_loading) + return; + + if (logger_hook_print) + weechat_unhook (logger_hook_print); + + logger_hook_print = weechat_hook_print ( + NULL, NULL, NULL, + (weechat_config_boolean (logger_config_file_color_lines)) ? 0 : 1, + &logger_print_cb, NULL, NULL); +} + +/* * Callback for changes on option "logger.file.flush_delay". */ @@ -92,7 +118,7 @@ logger_config_flush_delay_change (const void *pointer, void *data, if (logger_config_loading) return; - if (logger_timer) + if (logger_hook_timer) { if (weechat_logger_plugin->debug) { @@ -100,8 +126,8 @@ logger_config_flush_delay_change (const void *pointer, void *data, NULL, 0, "no_log", "%s: stopping timer", LOGGER_PLUGIN_NAME); } - weechat_unhook (logger_timer); - logger_timer = NULL; + weechat_unhook (logger_hook_timer); + logger_hook_timer = NULL; } if (weechat_config_integer (logger_config_file_flush_delay) > 0) @@ -114,9 +140,10 @@ logger_config_flush_delay_change (const void *pointer, void *data, LOGGER_PLUGIN_NAME, weechat_config_integer (logger_config_file_flush_delay)); } - logger_timer = weechat_hook_timer (weechat_config_integer (logger_config_file_flush_delay) * 1000, - 0, 0, - &logger_timer_cb, NULL, NULL); + logger_hook_timer = weechat_hook_timer ( + weechat_config_integer (logger_config_file_flush_delay) * 1000, + 0, 0, + &logger_timer_cb, NULL, NULL); } } @@ -435,7 +462,8 @@ logger_config_init () logger_config_color_backlog_line = weechat_config_new_option ( logger_config_file, ptr_section, "backlog_line", "color", - N_("color for backlog lines"), + N_("color for backlog lines, used only if the option " + "logger.file.color_lines is off"), NULL, -1, 0, "default", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); @@ -461,6 +489,15 @@ logger_config_init () "disables log)"), NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + logger_config_file_color_lines = weechat_config_new_option ( + logger_config_file, ptr_section, + "color_lines", "boolean", + N_("use ANSI color codes in lines written in log files and display " + "backlog lines with these colors"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, + &logger_config_color_lines_change, NULL, NULL, + NULL, NULL, NULL); logger_config_file_flush_delay = weechat_config_new_option ( logger_config_file, ptr_section, "flush_delay", "integer", diff --git a/src/plugins/logger/logger-config.h b/src/plugins/logger/logger-config.h index 207249a02..c3fce31f5 100644 --- a/src/plugins/logger/logger-config.h +++ b/src/plugins/logger/logger-config.h @@ -30,6 +30,7 @@ extern struct t_config_option *logger_config_color_backlog_end; extern struct t_config_option *logger_config_color_backlog_line; extern struct t_config_option *logger_config_file_auto_log; +extern struct t_config_option *logger_config_file_color_lines; extern struct t_config_option *logger_config_file_flush_delay; extern struct t_config_option *logger_config_file_fsync; extern struct t_config_option *logger_config_file_info_lines; @@ -44,6 +45,8 @@ extern struct t_config_option *logger_config_file_time_format; extern struct t_config_option *logger_config_get_level (const char *name); extern int logger_config_set_level (const char *name, const char *value); extern struct t_config_option *logger_config_get_mask (const char *name); +extern void logger_config_color_lines_change (const void *pointer, void *data, + struct t_config_option *option); extern int logger_config_init (); extern int logger_config_read (); extern int logger_config_write (); diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c index a04632186..a41d44dfe 100644 --- a/src/plugins/logger/logger.c +++ b/src/plugins/logger/logger.c @@ -51,7 +51,8 @@ WEECHAT_PLUGIN_PRIORITY(14000); struct t_weechat_plugin *weechat_logger_plugin = NULL; -struct t_hook *logger_timer = NULL; /* timer to flush log files */ +struct t_hook *logger_hook_timer = NULL; /* timer to flush log files */ +struct t_hook *logger_hook_print = NULL; /* @@ -610,7 +611,7 @@ logger_write_line (struct t_logger_buffer *logger_buffer, if (message) free (message); logger_buffer->flush_needed = 1; - if (!logger_timer) + if (!logger_hook_timer) { fflush (logger_buffer->log_file); if (weechat_config_boolean (logger_config_file_fsync)) @@ -1007,8 +1008,9 @@ logger_print_cb (const void *pointer, void *data, { struct t_logger_buffer *ptr_logger_buffer; struct tm *date_tmp; - char buf_time[256]; - int line_log_level, prefix_is_nick; + char buf_time[256], *prefix_ansi, *message_ansi; + const char *ptr_prefix, *ptr_message; + int line_log_level, prefix_is_nick, color_lines; /* make C compiler happy */ (void) pointer; @@ -1018,32 +1020,56 @@ logger_print_cb (const void *pointer, void *data, logger_get_line_tag_info (tags_count, tags, &line_log_level, &prefix_is_nick); - if (line_log_level >= 0) + if (line_log_level < 0) + return WEECHAT_RC_OK; + + ptr_logger_buffer = logger_buffer_search_buffer (buffer); + if (ptr_logger_buffer + && ptr_logger_buffer->log_enabled + && (date > 0) + && (line_log_level <= ptr_logger_buffer->log_level)) { - ptr_logger_buffer = logger_buffer_search_buffer (buffer); - if (ptr_logger_buffer - && ptr_logger_buffer->log_enabled - && (date > 0) - && (line_log_level <= ptr_logger_buffer->log_level)) + prefix_ansi = NULL; + message_ansi = NULL; + color_lines = weechat_config_boolean (logger_config_file_color_lines); + if (color_lines) { - buf_time[0] = '\0'; - date_tmp = localtime (&date); - if (date_tmp) - { - if (strftime (buf_time, sizeof (buf_time) - 1, - weechat_config_string (logger_config_file_time_format), - date_tmp) == 0) - buf_time[0] = '\0'; - } - - logger_write_line (ptr_logger_buffer, - "%s\t%s%s%s\t%s", - buf_time, - (prefix && prefix_is_nick) ? weechat_config_string (logger_config_file_nick_prefix) : "", - (prefix) ? prefix : "", - (prefix && prefix_is_nick) ? weechat_config_string (logger_config_file_nick_suffix) : "", - message); + prefix_ansi = weechat_hook_modifier_exec ("color_encode_ansi", + NULL, prefix); + message_ansi = weechat_hook_modifier_exec ("color_encode_ansi", + NULL, message); + ptr_prefix = prefix_ansi; + ptr_message = message_ansi; + } + else + { + ptr_prefix = prefix; + ptr_message = message; + } + buf_time[0] = '\0'; + date_tmp = localtime (&date); + if (date_tmp) + { + if (strftime (buf_time, sizeof (buf_time) - 1, + weechat_config_string (logger_config_file_time_format), + date_tmp) == 0) + buf_time[0] = '\0'; } + + logger_write_line ( + ptr_logger_buffer, + "%s\t%s%s%s\t%s%s", + buf_time, + (ptr_prefix && prefix_is_nick) ? weechat_config_string (logger_config_file_nick_prefix) : "", + (ptr_prefix) ? ptr_prefix : "", + (ptr_prefix && prefix_is_nick) ? weechat_config_string (logger_config_file_nick_suffix) : "", + (color_lines) ? "\x1B[0m" : "", + ptr_message); + + if (prefix_ansi) + free (prefix_ansi); + if (message_ansi) + free (message_ansi); } return WEECHAT_RC_OK; @@ -1103,7 +1129,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) weechat_hook_signal ("day_changed", &logger_day_changed_signal_cb, NULL, NULL); - weechat_hook_print (NULL, NULL, NULL, 1, &logger_print_cb, NULL, NULL); + logger_config_color_lines_change (NULL, NULL, NULL); logger_info_init (); @@ -1120,10 +1146,16 @@ weechat_plugin_end (struct t_weechat_plugin *plugin) /* make C compiler happy */ (void) plugin; - if (logger_timer) + if (logger_hook_print) + { + weechat_unhook (logger_hook_print); + logger_hook_print = NULL; + } + + if (logger_hook_timer) { - weechat_unhook (logger_timer); - logger_timer = NULL; + weechat_unhook (logger_hook_timer); + logger_hook_timer = NULL; } logger_config_write (); diff --git a/src/plugins/logger/logger.h b/src/plugins/logger/logger.h index 472b0512e..008c97888 100644 --- a/src/plugins/logger/logger.h +++ b/src/plugins/logger/logger.h @@ -30,7 +30,8 @@ struct t_logger_buffer; extern struct t_weechat_plugin *weechat_logger_plugin; -extern struct t_hook *logger_timer; +extern struct t_hook *logger_hook_timer; +extern struct t_hook *logger_hook_print; extern char *logger_build_option_name (struct t_gui_buffer *buffer); extern void logger_set_log_filename (struct t_logger_buffer *logger_buffer); @@ -38,6 +39,11 @@ extern void logger_start_buffer_all (int write_info_line); extern void logger_flush (); extern void logger_stop_all (int write_info_line); extern void logger_adjust_log_filenames (); +extern int logger_print_cb (const void *pointer, void *data, + struct t_gui_buffer *buffer, time_t date, + int tags_count, const char **tags, + int displayed, int highlight, + const char *prefix, const char *message); extern int logger_timer_cb (const void *pointer, void *data, int remaining_calls); |