1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 15:26:37 +02:00

core: log to stdout, if headless

Fixes https://github.com/weechat/weechat/issues/1475 .
This commit is contained in:
Tom Fitzhenry
2020-04-13 00:43:37 +10:00
committed by Sébastien Helleu
parent d38701f99f
commit 18a837c55b
5 changed files with 16 additions and 6 deletions
+1
View File
@@ -20,6 +20,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
New features::
* core: weechat-headless logs to stdout rather than ~/.weechat/weechat.log (issue #1475)
* buflist: evaluate option buflist.look.sort so that sort can be customized for each of the three buflist bar items (issue #1465)
* relay: add command "handshake" in weechat relay protocol and nonce to prevent replay attacks, add options relay.network.password_hash_algo, relay.network.password_hash_iterations, relay.network.nonce_size (issue #1474)
* relay: add option relay.network.auth_timeout
+9 -2
View File
@@ -68,17 +68,24 @@ log_open (const char *filename, const char *mode)
if (weechat_log_file)
return 0;
if (filename)
if (weechat_headless && !weechat_daemon)
{
weechat_log_file = stdout;
}
else if (filename)
{
weechat_log_filename = strdup (filename);
weechat_log_file = fopen (weechat_log_filename, mode);
}
else
{
filename_length = strlen (weechat_home) + 64;
weechat_log_filename = malloc (filename_length);
snprintf (weechat_log_filename, filename_length,
"%s/%s", weechat_home, WEECHAT_LOG_NAME);
weechat_log_file = fopen (weechat_log_filename, mode);
}
weechat_log_file = fopen (weechat_log_filename, mode);
if (!weechat_log_file)
{
free (weechat_log_filename);
+1
View File
@@ -88,6 +88,7 @@
#define OPTION_NO_GCRYPT 1002
int weechat_headless = 0; /* 1 if running headless (no GUI) */
int weechat_daemon = 0; /* 1 if daemonized (no foreground) */
int weechat_debug_core = 0; /* debug level for core */
char *weechat_argv0 = NULL; /* WeeChat binary file name (argv[0])*/
int weechat_upgrading = 0; /* =1 if WeeChat is upgrading */
+1
View File
@@ -100,6 +100,7 @@ struct t_weelist;
/* global variables and functions */
extern int weechat_headless;
extern int weechat_daemon;
extern int weechat_debug_core;
extern char *weechat_argv0;
extern int weechat_upgrading;
+4 -4
View File
@@ -88,7 +88,7 @@ daemonize ()
int
main (int argc, char *argv[])
{
int i, daemon;
int i;
weechat_init_gettext ();
@@ -104,16 +104,16 @@ main (int argc, char *argv[])
* If "--daemon" is received in command line arguments,
* daemonize the process.
*/
daemon = 0;
weechat_daemon = 0;
for (i = 1; i < argc; i++)
{
if (strcmp (argv[i], "--daemon") == 0)
{
daemon = 1;
weechat_daemon = 1;
break;
}
}
if (daemon)
if (weechat_daemon)
daemonize ();
/* init, main loop and end */