Skip to content

Rework native library #237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pythonfmu/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.6.7"
__version__ = "0.6.8"
17 changes: 10 additions & 7 deletions pythonfmu/fmi2slave.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,23 +308,26 @@ def _get_log_queue(self):
return self.log_queue

def log(
self,
msg: str,
status: Fmi2Status = Fmi2Status.ok,
category: Optional[str] = None,
debug: bool = False
self,
msg: str,
status: Fmi2Status = Fmi2Status.ok,
category: Optional[str] = None,
debug=None
):
"""Log a message to the FMU logger.

Args:
msg (str) : Log message
status (Fmi2Status) : Optional, message status (default ok)
category (str or None) : Optional, message category (default derived from status)
debug (bool) : Optional, is this a debug message (default False)
debug (bool) : Deprecated (has no effect)
"""
if debug is not None:
print(f"WARNING: 'debug' argument is deprecated and has no effect.")

if category is None:
category = f"logStatus{status.name.capitalize()}"
if category not in self.log_categories:
category = "logAll"
log_msg = LogMsg(status, category, msg, debug)
log_msg = LogMsg(status, category, msg)
self.log_queue.append(log_msg)
5 changes: 2 additions & 3 deletions pythonfmu/logmsg.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@

class LogMsg:

def __init__(self, status: int, category: str, msg: str, debug: bool):
def __init__(self, status: int, category: str, msg: str):
self.status = status
self.category = category
self.msg = msg
self.debug = debug

def __str__(self) -> str:
return "LogMsg(status={}, category={}, msg={}, debug={}".format(self.status, self.category, self.msg, self.debug)
return "LogMsg(status={}, category={}, msg={}".format(self.status, self.category, self.msg)



20 changes: 10 additions & 10 deletions pythonfmu/pythonfmu-export/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@

set(headers
cppfmu/cppfmu_cs.hpp
cppfmu/cppfmu_common.hpp

fmi/fmi2Functions.h
fmi/fmi2FunctionTypes.h
fmi/fmi2TypesPlatform.h
"fmi/fmi2Functions.h"
"fmi/fmi2FunctionTypes.h"
"fmi/fmi2TypesPlatform.h"

pythonfmu/PySlaveInstance.hpp
pythonfmu/PyState.hpp
"pythonfmu/fmu_except.hpp"
"pythonfmu/Logger.hpp"

"pythonfmu/SlaveInstance.hpp"
"pythonfmu/PyState.hpp"
)

set(sources
cppfmu/cppfmu_cs.cpp
cppfmu/fmi_functions.cpp
pythonfmu/PySlaveInstance.cpp
"pythonfmu/fmi2.cpp"
"pythonfmu/PySlaveInstance.cpp"
)

add_library(pythonfmu-export ${sources} ${headers})
Expand Down
Loading