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.
16 class AccessLogThread : public Thread {
18 // Used if we do not have a file to log to. The thread will still exist,
19 // but won't actually write anywhere.
22 // Log to a given file. If the file can't be opened, log an error
23 // to the error log, and work as if we didn't have a log file.
24 AccessLogThread(const std::string &filename);
26 // Add a log entry. Entries are written out at least once every second.
27 void write(const ClientStats& client);
30 virtual void do_work();
32 // The file we are logging to. If NULL, do not log.
36 pthread_mutex_t mutex;
37 std::vector<ClientStats> pending_writes;
40 #endif // _ACCESSLOG_H