Maestro
0.1.0
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
LogFile.h
Go to the documentation of this file.
1
9
10
#pragma once
11
12
#ifndef __LOG_FILE_H__
13
#define __LOG_FILE_H__
14
15
#include <fstream>
16
#include <iostream>
17
#include <string>
18
19
namespace
Utils
{
20
21
class
LogFile
{
22
public
:
23
LogFile
(
const
std::string &filename) {
24
logFile.open(filename, std::ios::out | std::ios::app);
25
if
(!logFile.is_open()) {
26
std::cerr <<
"Failed to open log file: "
<< filename << std::endl;
27
}
28
}
29
30
void
Log
(
const
std::string &message) {
31
if
(logFile.is_open()) {
32
logFile << message << std::endl;
33
}
else
{
34
std::cerr <<
"Log file is not open. Message: "
<< message << std::endl;
35
}
36
}
37
38
private
:
39
std::ofstream logFile;
40
};
41
42
}
// namespace Utils
43
44
#endif
// __LOG_FILE_H__
Utils::LogFile::Log
void Log(const std::string &message)
Definition
LogFile.h:30
Utils::LogFile::LogFile
LogFile(const std::string &filename)
Definition
LogFile.h:23
Utils
Definition
Alias.h:20
Utils
LogFile.h
Generated on
for Maestro by
1.15.0