FIXME: duplicate code LogFile or use LogFile instead
| 33 | // FIXME: duplicate code LogFile |
| 34 | // or use LogFile instead |
| 35 | string getFileName(const TcpConnectionPtr& conn) |
| 36 | { |
| 37 | string filename; |
| 38 | filename += conn->peerAddress().toIp(); |
| 39 | |
| 40 | char timebuf[32]; |
| 41 | struct tm tm; |
| 42 | time_t now = time(NULL); |
| 43 | gmtime_r(&now, &tm); // FIXME: localtime_r ? |
| 44 | strftime(timebuf, sizeof timebuf, ".%Y%m%d-%H%M%S.", &tm); |
| 45 | filename += timebuf; |
| 46 | |
| 47 | char buf[32]; |
| 48 | snprintf(buf, sizeof buf, "%d", globalCount_.incrementAndGet()); |
| 49 | filename += buf; |
| 50 | |
| 51 | filename += ".log"; |
| 52 | LOG_INFO << "Session of " << conn->name() << " file " << filename; |
| 53 | return filename; |
| 54 | } |
| 55 | |
| 56 | void onMessage(const TcpConnectionPtr& conn, |
| 57 | const MessagePtr& message, |
nothing calls this directly
no test coverage detected