4 // A class to log clients that just disconnected. Since this is shared by all
5 // Server instances, we try not to let write() block too much, and rather do
6 // all the I/O in a separate I/O thread.
17 class AccessLogThread : public Thread {
19 // Used if we do not have a file to log to. The thread will still exist,
20 // but won't actually write anywhere.
23 // Log to a given file. If the file can't be opened, log an error
24 // to the error log, and work as if we didn't have a log file.
25 AccessLogThread(const std::string &filename);
27 // Add a log entry. Entries are written out at least once every second.
28 void write(const ClientStats& client);
31 virtual void do_work();
33 // The file we are logging to. If nullptr, do not log.
38 std::vector<ClientStats> pending_writes;
41 #endif // _ACCESSLOG_H