mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 11:38:20 +00:00
Move DebugLogger to zeek namespaces
This commit is contained in:
parent
a2a435360a
commit
886fc102b8
40 changed files with 358 additions and 317 deletions
|
@ -96,7 +96,7 @@ void BasicThread::Start()
|
|||
|
||||
thread = std::thread(&BasicThread::launcher, this);
|
||||
|
||||
DBG_LOG(DBG_THREADING, "Started thread %s", name);
|
||||
DBG_LOG(zeek::DBG_THREADING, "Started thread %s", name);
|
||||
|
||||
OnStart();
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ void BasicThread::SignalStop()
|
|||
if ( terminating )
|
||||
return;
|
||||
|
||||
DBG_LOG(DBG_THREADING, "Signaling thread %s to terminate ...", name);
|
||||
DBG_LOG(zeek::DBG_THREADING, "Signaling thread %s to terminate ...", name);
|
||||
|
||||
OnSignalStop();
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ void BasicThread::WaitForStop()
|
|||
if ( ! started )
|
||||
return;
|
||||
|
||||
DBG_LOG(DBG_THREADING, "Waiting for thread %s to terminate and process last queue items...", name);
|
||||
DBG_LOG(zeek::DBG_THREADING, "Waiting for thread %s to terminate and process last queue items...", name);
|
||||
|
||||
OnWaitForStop();
|
||||
|
||||
|
@ -145,7 +145,7 @@ void BasicThread::Join()
|
|||
zeek::reporter->FatalError("Failure joining thread %s with error %s", name, e.what());
|
||||
}
|
||||
|
||||
DBG_LOG(DBG_THREADING, "Joined with thread %s", name);
|
||||
DBG_LOG(zeek::DBG_THREADING, "Joined with thread %s", name);
|
||||
}
|
||||
|
||||
void BasicThread::Kill()
|
||||
|
@ -160,7 +160,7 @@ void BasicThread::Kill()
|
|||
|
||||
void BasicThread::Done()
|
||||
{
|
||||
DBG_LOG(DBG_THREADING, "Thread %s has finished", name);
|
||||
DBG_LOG(zeek::DBG_THREADING, "Thread %s has finished", name);
|
||||
|
||||
terminating = true;
|
||||
killed = true;
|
||||
|
|
|
@ -21,7 +21,7 @@ void HeartbeatTimer::Dispatch(double t, bool is_expire)
|
|||
|
||||
Manager::Manager()
|
||||
{
|
||||
DBG_LOG(DBG_THREADING, "Creating thread manager ...");
|
||||
DBG_LOG(zeek::DBG_THREADING, "Creating thread manager ...");
|
||||
|
||||
did_process = true;
|
||||
next_beat = 0;
|
||||
|
@ -36,7 +36,7 @@ Manager::~Manager()
|
|||
|
||||
void Manager::Terminate()
|
||||
{
|
||||
DBG_LOG(DBG_THREADING, "Terminating thread manager ...");
|
||||
DBG_LOG(zeek::DBG_THREADING, "Terminating thread manager ...");
|
||||
terminating = true;
|
||||
|
||||
// First process remaining thread output for the message threads.
|
||||
|
@ -64,7 +64,7 @@ void Manager::Terminate()
|
|||
|
||||
void Manager::AddThread(BasicThread* thread)
|
||||
{
|
||||
DBG_LOG(DBG_THREADING, "Adding thread %s ...", thread->Name());
|
||||
DBG_LOG(zeek::DBG_THREADING, "Adding thread %s ...", thread->Name());
|
||||
all_threads.push_back(thread);
|
||||
|
||||
if ( ! heartbeat_timer_running )
|
||||
|
@ -73,13 +73,13 @@ void Manager::AddThread(BasicThread* thread)
|
|||
|
||||
void Manager::AddMsgThread(MsgThread* thread)
|
||||
{
|
||||
DBG_LOG(DBG_THREADING, "%s is a MsgThread ...", thread->Name());
|
||||
DBG_LOG(zeek::DBG_THREADING, "%s is a MsgThread ...", thread->Name());
|
||||
msg_threads.push_back(thread);
|
||||
}
|
||||
|
||||
void Manager::KillThreads()
|
||||
{
|
||||
DBG_LOG(DBG_THREADING, "Killing threads ...");
|
||||
DBG_LOG(zeek::DBG_THREADING, "Killing threads ...");
|
||||
|
||||
for ( all_thread_list::iterator i = all_threads.begin(); i != all_threads.end(); i++ )
|
||||
(*i)->Kill();
|
||||
|
@ -87,7 +87,7 @@ void Manager::KillThreads()
|
|||
|
||||
void Manager::KillThread(BasicThread* thread)
|
||||
{
|
||||
DBG_LOG(DBG_THREADING, "Killing thread %s ...", thread->Name());
|
||||
DBG_LOG(zeek::DBG_THREADING, "Killing thread %s ...", thread->Name());
|
||||
thread->Kill();
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ bool Manager::SendEvent(MsgThread* thread, const std::string& name, const int nu
|
|||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
DBG_LOG(DBG_INPUT, "Thread %s: SendEvent for event %s with %d vals",
|
||||
DBG_LOG(zeek::DBG_INPUT, "Thread %s: SendEvent for event %s with %d vals",
|
||||
thread->Name(), name.c_str(), num_vals);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ public:
|
|||
class DebugMessage final : public OutputMessage<MsgThread>
|
||||
{
|
||||
public:
|
||||
DebugMessage(DebugStream arg_stream, MsgThread* thread, const char* arg_msg)
|
||||
DebugMessage(zeek::DebugStream arg_stream, MsgThread* thread, const char* arg_msg)
|
||||
: OutputMessage<MsgThread>("DebugMessage", thread)
|
||||
{ stream = arg_stream; msg = copy_string(arg_msg); }
|
||||
|
||||
|
@ -120,7 +120,7 @@ public:
|
|||
}
|
||||
private:
|
||||
const char* msg;
|
||||
DebugStream stream;
|
||||
zeek::DebugStream stream;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -351,7 +351,7 @@ void MsgThread::InternalError(const char* msg)
|
|||
|
||||
#ifdef DEBUG
|
||||
|
||||
void MsgThread::Debug(DebugStream stream, const char* msg)
|
||||
void MsgThread::Debug(zeek::DebugStream stream, const char* msg)
|
||||
{
|
||||
SendOut(new DebugMessage(stream, this, msg));
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ void MsgThread::SendIn(BasicInputMessage* msg, bool force)
|
|||
return;
|
||||
}
|
||||
|
||||
DBG_LOG(DBG_THREADING, "Sending '%s' to %s ...", msg->Name(), Name());
|
||||
DBG_LOG(zeek::DBG_THREADING, "Sending '%s' to %s ...", msg->Name(), Name());
|
||||
|
||||
queue_in.Put(msg);
|
||||
++cnt_sent_in;
|
||||
|
@ -399,7 +399,7 @@ BasicOutputMessage* MsgThread::RetrieveOut()
|
|||
if ( ! msg )
|
||||
return nullptr;
|
||||
|
||||
DBG_LOG(DBG_THREADING, "Retrieved '%s' from %s", msg->Name(), Name());
|
||||
DBG_LOG(zeek::DBG_THREADING, "Retrieved '%s' from %s", msg->Name(), Name());
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
@ -413,7 +413,7 @@ BasicInputMessage* MsgThread::RetrieveIn()
|
|||
|
||||
#ifdef DEBUG
|
||||
std::string s = Fmt("Retrieved '%s' in %s", msg->Name(), Name());
|
||||
Debug(DBG_THREADING, s.c_str());
|
||||
Debug(zeek::DBG_THREADING, s.c_str());
|
||||
#endif
|
||||
|
||||
return msg;
|
||||
|
|
|
@ -170,7 +170,7 @@ public:
|
|||
*
|
||||
* @param msg The message. It will be prefixed with the thread's name.
|
||||
*/
|
||||
void Debug(DebugStream stream, const char* msg);
|
||||
void Debug(zeek::DebugStream stream, const char* msg);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue