Code Room
Code reviewHard
Question
Review this C++ thread-pool logger using a lazily created singleton.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
class Logger {public: static Logger* get() { if (!instance) { instance = new Logger(); instance->open("/var/log/app.log"); } return instance; } void write(const std::string& s) { out << s << "\n"; }private: static Logger* instance; std::ofstream out; void open(const char* p) { out.open(p, std::ios::app); }};Logger* Logger::instance = nullptr;Run or narrate your approach, then ask the coach.