]> git.vomp.tv Git - vompclient.git/blob - log.cc
New log class using {fmt}
[vompclient.git] / log.cc
1 #include <iostream>
2
3 #include "log.h"
4
5 LogNT* LogNT::instance = NULL;
6
7 LogNT::LogNT()
8 {
9   instance = this;
10 }
11
12 LogNT::~LogNT()
13 {
14   instance = NULL;
15 }
16
17 LogNT* LogNT::getInstance()
18 {
19   return instance;
20 }
21
22 bool LogNT::init(const std::string& tfileName, bool tenabled)
23 {
24   if (!tenabled) return true;
25
26   enabled = true;
27   fileName = tfileName; // Keep the filename for later?
28
29   if (!fileName.compare("stdout"))
30   {
31     outstream = &std::cout;
32     return true;
33   }
34
35   outstream = &logFile;
36   logFile.open(fileName);
37   if (!logFile.is_open()) return false;
38
39   return true;
40 }