Move Reporter to zeek namespace

This commit is contained in:
Tim Wojtulewicz 2020-07-20 10:57:36 -07:00
parent 7cedd94ee7
commit bfab224d7c
132 changed files with 1010 additions and 987 deletions

View file

@ -142,7 +142,7 @@ void BasicThread::Join()
}
catch ( const std::system_error& e )
{
reporter->FatalError("Failure joining thread %s with error %s", name, e.what());
zeek::reporter->FatalError("Failure joining thread %s with error %s", name, e.what());
}
DBG_LOG(DBG_THREADING, "Joined with thread %s", name);

View file

@ -138,7 +138,7 @@ bool Manager::SendEvent(MsgThread* thread, const std::string& name, const int nu
EventHandler* handler = event_registry->Lookup(name);
if ( handler == nullptr )
{
reporter->Warning("Thread %s: Event %s not found", thread->Name(), name.c_str());
zeek::reporter->Warning("Thread %s: Event %s not found", thread->Name(), name.c_str());
Value::delete_value_ptr_array(vals, num_vals);
return false;
}
@ -152,7 +152,7 @@ bool Manager::SendEvent(MsgThread* thread, const std::string& name, const int nu
int num_event_vals = type->NumFields();
if ( num_vals != num_event_vals )
{
reporter->Warning("Thread %s: Wrong number of values for event %s", thread->Name(), name.c_str());
zeek::reporter->Warning("Thread %s: Wrong number of values for event %s", thread->Name(), name.c_str());
Value::delete_value_ptr_array(vals, num_vals);
return false;
}
@ -216,7 +216,7 @@ void Manager::Flush()
else
{
reporter->Error("%s failed, terminating thread", msg->Name());
zeek::reporter->Error("%s failed, terminating thread", msg->Name());
t->SignalStop();
}

View file

@ -140,7 +140,7 @@ public:
bool success = thread_mgr->SendEvent(Object(), name, num_vals, val);
if ( ! success )
reporter->Error("SendEvent for event %s failed", name);
zeek::reporter->Error("SendEvent for event %s failed", name);
return true; // We do not want to die if sendEvent fails because the event did not return.
}
@ -163,35 +163,35 @@ bool ReporterMessage::Process()
switch ( type ) {
case INFO:
reporter->Info("%s: %s", Object()->Name(), msg);
zeek::reporter->Info("%s: %s", Object()->Name(), msg);
break;
case WARNING:
reporter->Warning("%s: %s", Object()->Name(), msg);
zeek::reporter->Warning("%s: %s", Object()->Name(), msg);
break;
case ERROR:
reporter->Error("%s: %s", Object()->Name(), msg);
zeek::reporter->Error("%s: %s", Object()->Name(), msg);
break;
case FATAL_ERROR:
reporter->FatalError("%s: %s", Object()->Name(), msg);
zeek::reporter->FatalError("%s: %s", Object()->Name(), msg);
break;
case FATAL_ERROR_WITH_CORE:
reporter->FatalErrorWithCore("%s: %s", Object()->Name(), msg);
zeek::reporter->FatalErrorWithCore("%s: %s", Object()->Name(), msg);
break;
case INTERNAL_WARNING:
reporter->InternalWarning("%s: %s", Object()->Name(), msg);
zeek::reporter->InternalWarning("%s: %s", Object()->Name(), msg);
break;
case INTERNAL_ERROR :
reporter->InternalError("%s: %s", Object()->Name(), msg);
zeek::reporter->InternalError("%s: %s", Object()->Name(), msg);
break;
default:
reporter->InternalError("unknown ReporterMessage type %d", type);
zeek::reporter->InternalError("unknown ReporterMessage type %d", type);
}
return true;
@ -207,7 +207,7 @@ MsgThread::MsgThread() : BasicThread(), queue_in(this, nullptr), queue_out(nullp
thread_mgr->AddMsgThread(this);
if ( ! iosource_mgr->RegisterFd(flare.FD(), this) )
reporter->FatalError("Failed to register MsgThread fd with iosource_mgr");
zeek::reporter->FatalError("Failed to register MsgThread fd with iosource_mgr");
SetClosed(false);
}
@ -276,7 +276,7 @@ void MsgThread::OnWaitForStop()
assert ( msg );
if ( ! msg->Process() )
reporter->Error("%s failed during thread termination", msg->Name());
zeek::reporter->Error("%s failed during thread termination", msg->Name());
delete msg;
}
@ -476,7 +476,7 @@ void MsgThread::Process()
if ( ! msg->Process() )
{
reporter->Error("%s failed, terminating thread", msg->Name());
zeek::reporter->Error("%s failed, terminating thread", msg->Name());
SignalStop();
}

View file

@ -127,7 +127,7 @@ inline static std::unique_lock<std::mutex> acquire_lock(std::mutex& m)
}
catch ( const std::system_error& e )
{
reporter->FatalErrorWithCore("cannot lock mutex: %s", e.what());
zeek::reporter->FatalErrorWithCore("cannot lock mutex: %s", e.what());
// Never gets here.
throw std::exception();
}
@ -218,7 +218,7 @@ inline std::vector<std::unique_lock<std::mutex>> Queue<T>::LocksForAllQueues()
catch ( const std::system_error& e )
{
reporter->FatalErrorWithCore("cannot lock all mutexes: %s", e.what());
zeek::reporter->FatalErrorWithCore("cannot lock all mutexes: %s", e.what());
// Never gets here.
throw std::exception();
}

View file

@ -316,8 +316,8 @@ bool Value::Read(SerializationFormat* fmt)
}
default:
reporter->InternalError("unsupported type %s in Value::Read",
zeek::type_name(type));
zeek::reporter->InternalError("unsupported type %s in Value::Read",
zeek::type_name(type));
}
return false;
@ -420,8 +420,8 @@ bool Value::Write(SerializationFormat* fmt) const
}
default:
reporter->InternalError("unsupported type %s in Value::Write",
zeek::type_name(type));
zeek::reporter->InternalError("unsupported type %s in Value::Write",
zeek::type_name(type));
}
// unreachable
@ -546,8 +546,8 @@ zeek::Val* Value::ValueToVal(const std::string& source, const Value* val, bool&
if ( ! enum_id )
{
reporter->Warning("Value '%s' of source '%s' is not a valid enum.",
enum_name.data(), source.c_str());
zeek::reporter->Warning("Value '%s' of source '%s' is not a valid enum.",
enum_name.data(), source.c_str());
have_error = true;
return nullptr;
@ -611,8 +611,8 @@ zeek::Val* Value::ValueToVal(const std::string& source, const Value* val, bool&
if ( ! id || ! id->IsEnumConst() )
{
reporter->Warning("Value '%s' for source '%s' is not a valid enum.",
enum_string.c_str(), source.c_str());
zeek::reporter->Warning("Value '%s' for source '%s' is not a valid enum.",
enum_string.c_str(), source.c_str());
have_error = true;
return nullptr;
@ -622,8 +622,8 @@ zeek::Val* Value::ValueToVal(const std::string& source, const Value* val, bool&
int intval = t->Lookup(id->ModuleName(), id->Name());
if ( intval < 0 )
{
reporter->Warning("Enum value '%s' for source '%s' not found.",
enum_string.c_str(), source.c_str());
zeek::reporter->Warning("Enum value '%s' for source '%s' not found.",
enum_string.c_str(), source.c_str());
have_error = true;
return nullptr;
@ -634,7 +634,7 @@ zeek::Val* Value::ValueToVal(const std::string& source, const Value* val, bool&
}
default:
reporter->InternalError("Unsupported type in SerialTypes::ValueToVal from source %s", source.c_str());
zeek::reporter->InternalError("Unsupported type in SerialTypes::ValueToVal from source %s", source.c_str());
}
assert(false);

View file

@ -201,7 +201,7 @@ void JSON::BuildJSON(NullDoubleWriter& writer, Value* val, const std::string& na
}
default:
reporter->Warning("Unhandled type in JSON::BuildJSON");
zeek::reporter->Warning("Unhandled type in JSON::BuildJSON");
break;
}
}