20 writers_.push_back(std::move(writer));
85 if (event_level <
level_)
return;
88 writer->write(*event, event_level);
SubscriptionId subscribe_all(EventCallback callback)
Subscribe to all events.
void unsubscribe(SubscriptionId id)
Unsubscribe using subscription ID.
Base class for all typed events in the simulation.
const std::string & source_id() const
Source model ID that generated this event.
virtual const char * type_name() const =0
Returns the type name of this event (for debugging/logging)
LogLevel classify_event(const Event &event) const
std::set< std::string > source_filters_
void add_type_filter(const std::string &type_name)
void add_writer(LogWriterPtr writer)
Add a writer for output (Logger takes ownership via shared_ptr)
void detach()
Detach from the current EventBus (stops logging)
void add_source_filter(const std::string &source_id)
void clear_writers()
Remove all writers.
std::set< std::string > type_filters_
void set_time_range(SimTime start, SimTime end)
Set time range filter.
void on_event(const EventPtr &event)
LogLevel level() const
Get the current log level.
void set_level(LogLevel level)
Set the minimum log level (events below this level are ignored)
void clear_type_filters()
Clear all type filters (log all types)
void attach(EventBus &bus)
Attach to an EventBus (starts logging)
bool passes_filters(const Event &event) const
void clear_source_filters()
Clear all source filters (log all sources)
void flush()
Flush all writers.
std::vector< LogWriterPtr > writers_
void clear_time_range()
Clear time range filter.
SubscriptionId subscription_id_
double SimTime
Represents a point in simulation time (continuous, in days)
std::shared_ptr< LogWriter > LogWriterPtr
std::shared_ptr< const Event > EventPtr
LogLevel
Log severity levels for filtering.