Convert job logging from debug to FLOG

This commit is contained in:
ridiculousfish
2019-05-18 13:47:27 -07:00
parent 63a16befd4
commit 8774860468
3 changed files with 15 additions and 6 deletions

View File

@@ -32,6 +32,7 @@
#include "env.h"
#include "exec.h"
#include "fallback.h" // IWYU pragma: keep
#include "flog.h"
#include "function.h"
#include "io.h"
#include "iothread.h"
@@ -639,8 +640,8 @@ static bool handle_builtin_output(parser_t &parser, const std::shared_ptr<job_t>
// TODO: factor this job-status-setting stuff into a single place.
p->completed = 1;
if (p->is_last_in_job) {
debug(4, L"Set status of job %d (%ls) to %d using short circuit", j->job_id,
j->preview().c_str(), p->status);
FLOGF(exec_job_status, L"Set status of job %d (%ls) to %d using short circuit",
j->job_id, j->preview().c_str(), p->status);
parser.set_last_statuses(j->get_statuses());
}
return true;
@@ -1096,8 +1097,8 @@ bool exec_job(parser_t &parser, shared_ptr<job_t> j) {
}
}
debug(3, L"Created job %d from command '%ls' with pgrp %d", j->job_id, j->command_wcstr(),
j->pgid);
FLOG(exec_job_exec, "Executed job", j->job_id, "from command", j->command_wcstr(), "with pgrp",
j->pgid);
j->set_flag(job_flag_t::CONSTRUCTED, true);
if (!j->is_foreground()) {

View File

@@ -48,6 +48,12 @@ class category_list_t {
category_t error{L"error", L"Serious unexpected errors (on by default)", true};
category_t debug{L"debug", L"Debugging aid (on by default)", true};
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"};
category_t proc_job_run{L"proc-job-run", L"Jobs getting started or continued"};
};
/// The class responsible for logging.

View File

@@ -38,6 +38,7 @@
#include "common.h"
#include "event.h"
#include "fallback.h" // IWYU pragma: keep
#include "flog.h"
#include "global_safety.h"
#include "io.h"
#include "output.h"
@@ -842,8 +843,9 @@ void job_t::continue_job(parser_t &parser, bool reclaim_foreground_pgrp, bool se
parser.job_promote(this);
set_flag(job_flag_t::NOTIFIED, false);
debug(4, L"%ls job %d, gid %d (%ls), %ls, %ls", send_sigcont ? L"Continue" : L"Start", job_id,
pgid, command_wcstr(), is_completed() ? L"COMPLETED" : L"UNCOMPLETED",
FLOGF(proc_job_run, L"%ls job %d, gid %d (%ls), %ls, %ls",
send_sigcont ? L"Continue" : L"Start", job_id, pgid, command_wcstr(),
is_completed() ? L"COMPLETED" : L"UNCOMPLETED",
is_interactive ? L"INTERACTIVE" : L"NON-INTERACTIVE");
// Make sure we retake control of the terminal before leaving this function.