Logger.hpp

1. Overview

Thread-safe logger interface. Declares severity levels, timestamp options, file output and singleton logging methods.

The original source path is:

include/bsc/logging/Logger.hpp

2. Role in the Daemon

This file participates in the privileged BastionGuard Secure Connection daemon. It uses the shared bsc models and follows the daemon-wide fallback strategy: optional high-fidelity backends are used when available, while portable polling or stub behavior preserves service startup.


3. Namespaces

  • bsc::logging

4. Dependencies and Included Interfaces

  • mutex
  • string

5. Declared Types

  • enum class Level
  • class Logger

6. State and Data Members

The interface declares the following relevant state members:

  • std::string file_path_
  • mutable std::mutex mutex_

7. API and Functions

The file declares or implements the following callable entry points:

  • public: static Logger& instance()
  • void set_level(Level level)
  • void set_utc(bool enabled)
  • void set_microseconds(bool enabled)
  • void set_log_file(const std::string& path)
  • void debug(const std::string& msg)
  • void info(const std::string& msg)
  • void warning(const std::string& msg)
  • void error(const std::string& msg)
  • private: void log(Level level, const std::string& msg)
  • std::string timestamp() const
  • std::string level_name(Level level) const

8. Concurrency and Lifecycle

  • Protects mutable shared data with std::mutex.

9. Implementation Considerations

  • Shared state is protected by mutexes; callers should avoid holding external locks while invoking callbacks.

10. Source Metrics

MetricValue
File size826 bytes
Lines33
Detected API entries12
Detected types2