MicroModelicaCCompiler
4.5.3
logger.cpp
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
#include "
logger.hpp
"
21
22
#include <
util/util.hpp
>
23
24
using namespace
std;
25
26
namespace
MicroModelica
{
27
namespace
Util {
28
Logger::Logger() : _log_file(), _logs_path() {}
29
30
Logger::~Logger
() {
log
.close(); }
31
32
void
Logger::setFile
(
string
file_name)
33
{
34
string
build_path =
Utils::instance
().
environmentVariable
(
"MMOC_BUILD"
);
35
string
base_name =
Utils::instance
().
baseFileName
(file_name);
36
_logs_path
= build_path +
SLASH
+ base_name +
SLASH
;
37
_log_file
=
_logs_path
+ base_name +
".log"
;
38
log
.open(
_log_file
, std::ofstream::out);
39
}
40
41
std::string
Logger::getLoggerFile
()
const
{
return
_log_file
; }
42
43
std::string
Logger::getLogsPath
()
const
{
return
_logs_path
; }
44
45
}
// namespace Util
46
}
// 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::Utils::baseFileName
std::string baseFileName(std::string file)
Definition:
util.cpp:338
MicroModelica::Util::Logger::~Logger
~Logger()
Definition:
logger.cpp:30
MicroModelica::Util::Logger::getLogsPath
std::string getLogsPath() const
Definition:
logger.cpp:43
SLASH
#define SLASH
Definition:
util.hpp:70
MicroModelica::Util::Logger::log
std::ofstream log
Definition:
logger.hpp:79
MicroModelica
Definition:
files.cpp:45
logger.hpp
MicroModelica::Util::Utils::instance
static Utils & instance()
Definition:
util.hpp:83
MicroModelica::Util::Utils::environmentVariable
std::string environmentVariable(std::string ev)
Definition:
util.cpp:307
MicroModelica::Util::Logger::_logs_path
std::string _logs_path
Definition:
logger.hpp:83
util.hpp
MicroModelica::Util::Logger::_log_file
std::string _log_file
Definition:
logger.hpp:82
util
logger.cpp
Generated on Fri Feb 21 2025 11:43:43 for MicroModelicaCCompiler by
1.8.17