Add flog category for config reading

This commit is contained in:
Fabian Homborg 2020-01-19 13:53:23 +01:00
parent 123676075f
commit 5da4f7e7c5
2 changed files with 9 additions and 7 deletions

View file

@ -136,13 +136,13 @@ static struct config_paths_t determine_config_directory_paths(const char *argv0)
bool done = false;
std::string exec_path = get_executable_path(argv0);
if (get_realpath(exec_path)) {
debug(2, L"exec_path: '%s', argv[0]: '%s'", exec_path.c_str(), argv0);
FLOGF(config, L"exec_path: '%s', argv[0]: '%s'", exec_path.c_str(), argv0);
// TODO: we should determine program_name from argv0 somewhere in this file
#ifdef CMAKE_BINARY_DIR
// Detect if we're running right out of the CMAKE build directory
if (string_prefixes_string(CMAKE_BINARY_DIR, exec_path.c_str())) {
debug(2,
FLOGF(config,
"Running out of build directory, using paths relative to CMAKE_SOURCE_DIR:\n %s",
CMAKE_SOURCE_DIR);
@ -163,7 +163,7 @@ static struct config_paths_t determine_config_directory_paths(const char *argv0)
if (has_suffix(exec_path, installed_suffix, false)) {
suffix = installed_suffix;
} else if (has_suffix(exec_path, just_a_fish, false)) {
debug(2, L"'fish' not in a 'bin/', trying paths relative to source tree");
FLOGF(config, L"'fish' not in a 'bin/', trying paths relative to source tree");
suffix = just_a_fish;
}
@ -194,14 +194,14 @@ static struct config_paths_t determine_config_directory_paths(const char *argv0)
if (!done) {
// Fall back to what got compiled in.
debug(2, L"Using compiled in paths:");
FLOGF(config, L"Using compiled in paths:");
paths.data = L"" DATADIR "/fish";
paths.sysconf = L"" SYSCONFDIR "/fish";
paths.doc = L"" DOCDIR;
paths.bin = L"" BINDIR;
}
debug(2,
FLOGF(config,
L"determine_config_directory_paths() results:\npaths.data: %ls\npaths.sysconf: "
L"%ls\npaths.doc: %ls\npaths.bin: %ls",
paths.data.c_str(), paths.sysconf.c_str(), paths.doc.c_str(), paths.bin.c_str());
@ -221,10 +221,10 @@ static void source_config_in_directory(const wcstring &dir) {
const wcstring escaped_dir = escape_string(dir, ESCAPE_ALL);
const wcstring escaped_pathname = escaped_dir + L"/config.fish";
if (waccess(config_pathname, R_OK) != 0) {
debug(2, L"not sourcing %ls (not readable or does not exist)", escaped_pathname.c_str());
FLOGF(config, L"not sourcing %ls (not readable or does not exist)", escaped_pathname.c_str());
return;
}
debug(2, L"sourcing %ls", escaped_pathname.c_str());
FLOGF(config, L"sourcing %ls", escaped_pathname.c_str());
const wcstring cmd = L"builtin source " + escaped_pathname;
parser_t &parser = parser_t::principal_parser();

View file

@ -53,6 +53,8 @@ class category_list_t {
category_t warning{L"warning", L"Warnings (on by default)", true};
category_t config{L"config", L"Finding and reading configuration"};
category_t exec_job_status{L"exec-job-status", L"Jobs changing status"};
category_t exec_job_exec{L"exec-job-exec", L"Jobs being executed"};