#pragma once

#include "core/eventBus/eventBus.h"

#include <thread>

//--------------------------------------------------------------
class Logger : public sdi_toolBox::desktop::eventBus::Node
{
  public:
  Logger() = delete;                                     // Default constructor
  virtual ~Logger();                                     // Default destructor
  Logger(const Logger &obj)                = delete;     // Copy constructor
  Logger(Logger &&obj) noexcept            = delete;     // Move constructor
  Logger &operator=(const Logger &obj)     = delete;     // Copy assignment operator
  Logger &operator=(Logger &&obj) noexcept = delete;     // Move assignment operator

  explicit Logger(sdi_toolBox::desktop::eventBus::Bus &hBus);     // Constructor

  protected:
  std::jthread m_thread;

  private:
  void run();                                                // Start the logger's main thread to process incoming messages
  void stop();                                               // Stop the logger's main thread and clean up resources
  void processLogMessages(const std::stop_token &token);     // Process incoming log messages from the event bus
};
//--------------------------------------------------------------
