aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/starting.txt2
-rw-r--r--src/nvim/log.c16
2 files changed, 8 insertions, 10 deletions
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt
index 79459e74c3..4a99aa47bf 100644
--- a/runtime/doc/starting.txt
+++ b/runtime/doc/starting.txt
@@ -1339,7 +1339,7 @@ DATA DIRECTORY (DEFAULT) ~
Note: Throughout the user manual these defaults are used as placeholders, e.g.
"~/.config" is understood to mean "$XDG_CONFIG_HOME or ~/.config".
-LOG FILE *$NVIM_LOG_FILE* *E5010*
+LOG FILE *$NVIM_LOG_FILE*
Besides 'debug' and 'verbose', Nvim keeps a general log file for internal
debugging, plugins and RPC clients. >
:echo $NVIM_LOG_FILE
diff --git a/src/nvim/log.c b/src/nvim/log.c
index 98df2c799a..324382a0f7 100644
--- a/src/nvim/log.c
+++ b/src/nvim/log.c
@@ -22,7 +22,6 @@
#include "nvim/os/time.h"
#define LOG_FILE_ENV "NVIM_LOG_FILE"
-#define LOGERR "E5010: "
/// Cached location of the expanded log file path decided by log_path_init().
static char log_file_path[MAXPATHL + 1] = { 0 };
@@ -73,15 +72,10 @@ static bool log_path_init(void)
// Make kXDGCacheHome if it does not exist.
char *cachehome = get_xdg_home(kXDGCacheHome);
char *failed_dir = NULL;
+ bool log_dir_failure = false;
if (!os_isdir((char_u *)cachehome)) {
- int ret;
- if ((ret = os_mkdir_recurse(cachehome, 0700, &failed_dir)) != 0) {
- EMSG3(_(LOGERR "Failed to create directory %s "
- "for writing logs: %s"),
- failed_dir, os_strerror(ret));
- }
+ log_dir_failure = (os_mkdir_recurse(cachehome, 0700, &failed_dir) != 0);
}
- XFREE_CLEAR(failed_dir);
XFREE_CLEAR(cachehome);
// Invalid $NVIM_LOG_FILE or failed to expand; fall back to default.
char *defaultpath = stdpaths_user_cache_subpath("log");
@@ -97,6 +91,11 @@ static bool log_path_init(void)
return false;
}
os_setenv(LOG_FILE_ENV, log_file_path, true);
+ if (log_dir_failure) {
+ WLOG("Failed to create directory %s for writing logs: %s",
+ failed_dir, os_strerror(log_dir_failure));
+ }
+ XFREE_CLEAR(failed_dir);
}
return true;
}
@@ -337,4 +336,3 @@ static bool v_do_log_to_file(FILE *log_file, int log_level,
return true;
}
-