#pragma once #include #include #include using namespace std; // Access is thread-safe class MultiLog { struct Item { int id; string line; bool complete = false; Item(); }; mutex mut; vector items; const bool fancy; // Methods assume mutex is taken. size_t findId(int id); void redrawLine(size_t idx); public: MultiLog(bool fancy); // Returns id of new item int add(const string_view prefix); void append(int id, const string_view text); void complete(int id); };