MicroModelicaCCompiler  4.5.3
logger.hpp
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  This file is part of QSS Solver.
4 
5  QSS Solver is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  QSS Solver is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QSS Solver. If not, see <http://www.gnu.org/licenses/>.
17 
18  ******************************************************************************/
19 
20 
21 #pragma once
22 
23 #include <fstream>
24 #include <string>
25 
26 namespace MicroModelica {
27 namespace Util {
28 
29 #define LOG Logger::instance().log
30 
31 class Logger {
32  public:
33  static Logger& instance()
34  {
35  static Logger _instance;
36  return _instance;
37  }
38  ~Logger();
39 
40  void setFile(std::string file_name);
41 
42  std::string getLoggerFile() const;
43  std::string getLogsPath() const;
44 
45  std::ofstream log;
46 
47  protected:
48  std::string _log_file;
49  std::string _logs_path;
50 
51  private:
52  Logger();
53 };
54 } // namespace Util
55 } // namespace MicroModelica
MicroModelica::Util::Logger::getLoggerFile
std::string getLoggerFile() const
Definition: logger.cpp:41
MicroModelica::Util::Logger::setFile
void setFile(std::string file_name)
Definition: logger.cpp:32
MicroModelica::Util::Logger::instance
static Logger & instance()
Definition: logger.hpp:67
MicroModelica::Util::Logger::Logger
Logger()
Definition: logger.cpp:28
MicroModelica::Util::Logger::~Logger
~Logger()
Definition: logger.cpp:30
MicroModelica::Util::Logger::getLogsPath
std::string getLogsPath() const
Definition: logger.cpp:43
MicroModelica::Util::Logger::log
std::ofstream log
Definition: logger.hpp:79
MicroModelica
Definition: files.cpp:45
MicroModelica::Util::Logger::_logs_path
std::string _logs_path
Definition: logger.hpp:83
MicroModelica::Util::Logger::_log_file
std::string _log_file
Definition: logger.hpp:82