Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
passing on instanceEnvironment to logger callback
Browse files Browse the repository at this point in the history
iangardnersiemens committed Jan 14, 2025
1 parent d42110a commit 9b429f1
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 0 additions & 3 deletions pythonfmu3/pythonfmu-export/src/cppfmu/cppfmu_common.hpp
Original file line number Diff line number Diff line change
@@ -105,11 +105,9 @@ class Logger

Logger(
FMIComponentEnvironment component,
String instanceName,
fmi3LogMessageCallback logCallback,
std::shared_ptr<Settings> settings)
: m_component{component}
, m_instanceName(std::move(instanceName))
, m_fmiLogger{logCallback}
, m_settings{settings}
{
@@ -154,7 +152,6 @@ class Logger

private:
const FMIComponentEnvironment m_component;
const String m_instanceName;
const FMICallbackLogger m_fmiLogger;
std::shared_ptr<Settings> m_settings;
};
7 changes: 4 additions & 3 deletions pythonfmu3/pythonfmu-export/src/cppfmu/fmi_functions.cpp
Original file line number Diff line number Diff line change
@@ -47,10 +47,10 @@ struct Component
modelError = 1 << 12,
modelFatal = 1 << 13,
};
Component(cppfmu::FMIString instanceName,
Component(cppfmu::FMIComponentEnvironment instanceEnvironment,
cppfmu::FMICallbackLogger logCallback,
cppfmu::FMIBoolean loggingOn) : loggerSettings{std::make_shared<cppfmu::Logger::Settings>()},
logger{this, instanceName, logCallback, loggerSettings}, lastSuccessfulTime{std::numeric_limits<cppfmu::FMIFloat64>::quiet_NaN()}
logger{instanceEnvironment, logCallback, loggerSettings}, lastSuccessfulTime{std::numeric_limits<cppfmu::FMIFloat64>::quiet_NaN()}
{
loggerSettings->debugLoggingEnabled = (loggingOn == cppfmu::FMITrue);
}
@@ -96,7 +96,8 @@ fmi3Instance fmi3InstantiateCoSimulation(
fmi3IntermediateUpdateCallback intermediateUpdate )
{
try {
auto component = new Component(instanceName,
auto component = new Component(
environment,
logMessage,
loggingOn);
component->slave = CppfmuInstantiateSlave(

0 comments on commit 9b429f1

Please sign in to comment.