FACT++  1.0
bool WindowLog::OpenLogFile ( const std::string &  filename,
bool  append = false 
)

Open a log-file.

Open a log-file into which any of the following output is written. If a log-file is alraedy open it is closed. before the new file is opened or an old one closed the current buffer is flushed.

Parameters
filenameThe filename of the file to open
Returns
Whether the log-file stream is open or not
Examples:
chatserv.cc.

Definition at line 111 of file WindowLog.cc.

Referenced by Main::execute(), main(), RunDim(), RunShell(), and SetWindow().

112 {
113  fMuxFile.lock();
114  flush();
115 
116  if (fLogFile.is_open())
117  fLogFile.close();
118 
119  fLogFile.open(filename, append ? ios::app|ios::out : ios::out);
120  if (append)
121  fLogFile << '\n';
122 
123  fMuxFile.unlock();
124 
125  return fLogFile.is_open();
126 }
std::mutex fMuxFile
Mutex securing backlog access.
Definition: WindowLog.h:74
std::ofstream fLogFile
Storage for attributes (backlog)
Definition: WindowLog.h:68

+ Here is the caller graph for this function: