From 34308f8f7fc8d29d121aa6bcf75ac0496a895f4d Mon Sep 17 00:00:00 2001 From: Henry <henry.korb@geo.uu.se> Date: Wed, 7 Dec 2022 17:49:57 +0100 Subject: [PATCH] improvement in logger bindings --- pythonbindings/pyfluids-stubs/bindings/logger.pyi | 7 ++++--- pythonbindings/src/logger/logger.cpp | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pythonbindings/pyfluids-stubs/bindings/logger.pyi b/pythonbindings/pyfluids-stubs/bindings/logger.pyi index 3c1f4b59b..ead1b2898 100644 --- a/pythonbindings/pyfluids-stubs/bindings/logger.pyi +++ b/pythonbindings/pyfluids-stubs/bindings/logger.pyi @@ -1,7 +1,8 @@ class Logger: - def __init__(self, *args, **kwargs) -> None: ... - def change_log_path(self) -> None: ... - def initialize_logger(self) -> None: ... + @staticmethod + def change_log_path(path: str) -> None: ... + @staticmethod + def initialize_logger() -> None: ... def vf_log_critical(message: str) -> None: ... def vf_log_debug(message: str) -> None: ... diff --git a/pythonbindings/src/logger/logger.cpp b/pythonbindings/src/logger/logger.cpp index 0577f0bc1..bae2f9362 100644 --- a/pythonbindings/src/logger/logger.cpp +++ b/pythonbindings/src/logger/logger.cpp @@ -10,8 +10,8 @@ namespace logging py::module loggerModule = parentModule.def_submodule("logger"); py::class_<vf::logging::Logger>(loggerModule, "Logger") - .def("initialize_logger", &vf::logging::Logger::initalizeLogger) - .def("change_log_path", &vf::logging::Logger::changeLogPath); + .def_static("initialize_logger", &vf::logging::Logger::initalizeLogger) + .def_static("change_log_path", &vf::logging::Logger::changeLogPath, py::arg("path")); // use f-strings (f"text {float}") in python for compounded messages loggerModule.def("vf_log_trace", [](std::string message){ VF_LOG_TRACE(message); }, py::arg("message")); -- GitLab