Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit da270f8

Browse files
rfrankeOpenModelica-Hudson
authored andcommitted
Enable Cpp logger under Windows and finalize it, ticket:4773
The finalizer shall flush buffers, e.g. of LoggerXMLTCP. Belonging to [master]: - #2246
1 parent 67e62cb commit da270f8

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

Compiler/Template/CodegenCpp.tpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2381,13 +2381,14 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
23812381
>>
23822382
%>
23832383

2384+
Logger::finalize();
23842385
return 0;
2385-
23862386
}
23872387
catch(ModelicaSimulationError& ex)
23882388
{
23892389
if(!ex.isSuppressed())
23902390
std::cerr << "Simulation stopped with error in " << error_id_string(ex.getErrorID()) << ": " << ex.what();
2391+
Logger::finalize();
23912392
return 1;
23922393
}
23932394
}

SimulationRuntime/cpp/Core/Utils/extension/logger.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ void Logger::initialize(LogSettings settings)
3636
}
3737
}
3838

39+
void Logger::finalize()
40+
{
41+
if (_instance != NULL)
42+
delete _instance;
43+
}
44+
3945
void Logger::writeInternal(std::string msg, LogCategory cat, LogLevel lvl,
4046
LogStructure ls)
4147
{

SimulationRuntime/cpp/Include/Core/Utils/extension/logger.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ class BOOST_EXTENSION_LOGGER_DECL Logger
5555
initialize(LogSettings());
5656
}
5757

58+
static void finalize();
59+
5860
static inline void write(std::string msg, LogCategory cat, LogLevel lvl)
5961
{
6062
if (_instance && _instance->isSet(cat, lvl))

SimulationRuntime/cpp/Makefile.omdev.mingw

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ else
8181
PARALLEL_OUTPUT_COMMAND=-DUSE_PARALLEL_OUTPUT=OFF
8282
endif
8383

84-
USE_LOGGER="false"
84+
USE_LOGGER="true"
8585
ifeq ("$(USE_LOGGER)","true")
8686
USE_LOGGER_COMMAND=-DUSE_LOGGER:BOOL=ON
8787
else

0 commit comments

Comments
 (0)