Skip to content

Commit

Permalink
Change calls to debug log to verbose (#6369)
Browse files Browse the repository at this point in the history
  • Loading branch information
Breakwell committed Apr 9, 2020
1 parent 702a6e0 commit fb6b514
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions osquery/dispatcher/dispatcher.cpp
Expand Up @@ -16,7 +16,6 @@ namespace osquery {
/// The worker_threads define the default thread pool size.
FLAG(int32, worker_threads, 4, "Number of work dispatch threads");


void InterruptableRunnable::interrupt() {
// Set the service as interrupted.
if (!interrupted_.exchange(true)) {
Expand Down Expand Up @@ -75,9 +74,9 @@ Status Dispatcher::addService(InternalRunnableRef service) {

auto thread = std::make_unique<std::thread>(
std::bind(&InternalRunnable::run, &*service));
DLOG(INFO) << "Adding new service: " << service->name() << " ("
<< service.get() << ") to thread: " << thread->get_id() << " ("
<< thread.get() << ") in process " << platformGetPid();
VLOG(1) << "Adding new service: " << service->name() << " ("
<< service.get() << ") to thread: " << thread->get_id() << " ("
<< thread.get() << ") in process " << platformGetPid();

self.service_threads_.push_back(std::move(thread));
self.services_.push_back(std::move(service));
Expand Down Expand Up @@ -119,8 +118,7 @@ inline static void assureRun(const InternalRunnableRef& service) {

void Dispatcher::joinServices() {
auto& self = instance();
DLOG(INFO) << "Thread: " << std::this_thread::get_id()
<< " requesting a join";
VLOG(1) << "Thread: " << std::this_thread::get_id() << " requesting a join";

// Stops when service_threads_ is empty. Before stopping and releasing of the
// lock, empties services_ .
Expand All @@ -138,24 +136,23 @@ void Dispatcher::joinServices() {
}
if (thread != nullptr) {
thread->join();
DLOG(INFO) << "Service thread: " << thread.get() << " has joined";
VLOG(1) << "Service thread: " << thread.get() << " has joined";
}
}

DLOG(INFO) << "Services and threads have been cleared";
VLOG(1) << "Services and threads have been cleared";
}

void Dispatcher::stopServices() {
auto& self = instance();
DLOG(INFO) << "Thread: " << std::this_thread::get_id()
<< " requesting a stop";
VLOG(1) << "Thread: " << std::this_thread::get_id() << " requesting a stop";

WriteLock lock(self.mutex_);
self.stopping_ = true;
for (const auto& service : self.services_) {
assureRun(service);
service->interrupt();
DLOG(INFO) << "Service: " << service.get() << " has been interrupted";
VLOG(1) << "Service: " << service.get() << " has been interrupted";
}
}
} // namespace osquery

0 comments on commit fb6b514

Please sign in to comment.