File: chatlogger.h

package info (click to toggle)
warmux 1%3A11.04.1%2Brepack2-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid
  • size: 126,388 kB
  • sloc: cpp: 186,040; xml: 8,909; sh: 3,358; makefile: 1,052; ansic: 713
file content (24 lines) | stat: -rw-r--r-- 602 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#ifndef CHATLOGGER_H
#define CHATLOGGER_H

#include <iostream>
#include <fstream>
#include <WARMUX_singleton.h>

class ChatLogger: public Singleton<ChatLogger>
{
  std::string logdir;
  std::string logfile;
  std::ofstream m_logfilename;
 protected:
  friend class Singleton<ChatLogger>;
 public:
  ChatLogger();
  ~ChatLogger() { m_logfilename.close(); }

  void LogMessage(const std::string& msg);
  static void LogMessageIfOpen(const std::string& msg) { if (singleton) singleton->LogMessage(msg); } 
  static void CloseIfOpen(void) { if (singleton) singleton->CleanUp(); }
};

#endif //CHATLOGGER_H