-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
427ad25
commit 7498a76
Showing
4 changed files
with
230 additions
and
0 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
lang/python/nanobind_core/src/modules/module_logging_config.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* ========================= eCAL LICENSE ================================= | ||
* | ||
* Copyright (C) 2016 - 2024 Continental Corporation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* ========================= eCAL LICENSE ================================= | ||
*/ | ||
|
||
/** | ||
* @brief Add Publisher config structs to nanobind module | ||
**/ | ||
|
||
|
||
#include <modules/module_logging_config.h> | ||
#include <wrappers/wrapper_logging_config.h> | ||
|
||
void AddLoggingConfigStructToModule(const nanobind::module_& module) | ||
{ | ||
// Bind the Console::Configuration structure | ||
nanobind::class_<eCAL::Logging::Sinks::Console::CNBConsoleConfiguration>(m, "ConsoleConfiguration") | ||
.def(nanobind::init<>()) // Constructor binding | ||
.def_rw("enable", &eCAL::Logging::Sinks::Console::CNBConsoleConfiguration::enable) | ||
.def_rw("filter_log_con", &eCAL::Logging::Sinks::Console::CNBConsoleConfiguration::filter_log_con); | ||
|
||
// Bind the File::Configuration structure | ||
nanobind::class_<eCAL::Logging::Sinks::File::CNBFileConfiguration>(m, "FileConfiguration") | ||
.def(nanobind::init<>()) // Constructor binding | ||
.def_rw("enable", &eCAL::Logging::Sinks::File::CNBFileConfiguration::enable) | ||
.def_rw("path", &eCAL::Logging::Sinks::File::CNBFileConfiguration::path) | ||
.def_rw("filter_log_file", &eCAL::Logging::Sinks::File::CNBFileConfiguration::filter_log_file); | ||
|
||
// Bind the UDP::Configuration structure | ||
nanobind::class_<eCAL::Logging::Sinks::UDP::CNBUDPConfiguration>(m, "UDPConfiguration") | ||
.def(nanobind::init<>()) // Constructor binding | ||
.def_rw("enable", &eCAL::Logging::Sinks::UDP::CNBUDPConfiguration::enable) | ||
.def_rw("port", &eCAL::Logging::Sinks::UDP::CNBUDPConfiguration::port) | ||
.def_rw("filter_log_udp", &eCAL::Logging::Sinks::UDP::CNBUDPConfiguration::filter_log_udp); | ||
|
||
// Bind the Sinks::Configuration structure | ||
nanobind::class_<eCAL::Logging::Sinks::NBSinksConfiguration>(m, "SinksConfiguration") | ||
.def(nanobind::init<>()) // Constructor binding | ||
.def_rw("console", &eCAL::Logging::Sinks::NBSinksConfiguration::console) | ||
.def_rw("file", &eCAL::Logging::Sinks::NBSinksConfiguration::file) | ||
.def_rw("udp", &eCAL::Logging::Sinks::NBSinksConfiguration::udp); | ||
|
||
// Bind the Logging::Configuration structure | ||
nanobind::class_<eCAL::Logging::CNBLoggingConfiguration>(m, "LoggingConfiguration") | ||
.def(nanobind::init<>()) // Constructor binding | ||
.def_rw("sinks", &eCAL::Logging::CNBLoggingConfiguration::sinks); | ||
|
||
} | ||
|
46 changes: 46 additions & 0 deletions
46
lang/python/nanobind_core/src/modules/module_logging_config.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* ========================= eCAL LICENSE ================================= | ||
* | ||
* Copyright (C) 2016 - 2024 Continental Corporation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* ========================= eCAL LICENSE ================================= | ||
*/ | ||
|
||
/** | ||
* @file module_datatypeinfo.h | ||
* @brief Nanobind module for structs of file config/logging.h | ||
**/ | ||
|
||
#pragma once | ||
|
||
#include <nanobind/nanobind.h> | ||
#include <nanobind/operators.h> | ||
#include <ecal/ecal.h> | ||
#include <nanobind/operators.h> | ||
#include <nanobind/stl/string.h> | ||
#include <nanobind/stl/shared_ptr.h> | ||
#include <nanobind/stl/tuple.h> | ||
#include <cstdint> | ||
#include <chrono> | ||
#include <memory> | ||
#include <string> | ||
#include <cstddef> | ||
#include <ecal/ecal_types.h> | ||
|
||
/** | ||
* @brief Function to Add Nanobind module | ||
* | ||
* @param module The nanobind module variable | ||
**/ | ||
void AddLoggingConfigStructToModule(const nanobind::module_& module); |
32 changes: 32 additions & 0 deletions
32
lang/python/nanobind_core/src/wrappers/wrapper_logging_config.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* ========================= eCAL LICENSE ================================= | ||
* | ||
* Copyright (C) 2016 - 2024 Continental Corporation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* ========================= eCAL LICENSE ================================= | ||
*/ | ||
|
||
/** | ||
* @brief logging.h configuration, adapted for Nanobind | ||
**/ | ||
|
||
#include <wrappers/wrapper_logging_config.h> | ||
|
||
namespace eCAL | ||
{ | ||
//Logging::Sinks::CNBLoggingConfiguration::CNBLoggingConfiguration() | ||
//{ | ||
// Logging::Sinks::Configuration::Configuration(); | ||
//} | ||
} |
89 changes: 89 additions & 0 deletions
89
lang/python/nanobind_core/src/wrappers/wrapper_logging_config.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* ========================= eCAL LICENSE ================================= | ||
* | ||
* Copyright (C) 2016 - 2024 Continental Corporation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* ========================= eCAL LICENSE ================================= | ||
*/ | ||
|
||
/** | ||
* @file wrapper_publisher_config.h | ||
* @brief Nanobind wrapper for structs of Publisher config | ||
**/ | ||
|
||
#pragma once | ||
|
||
#include <ecal/ecal.h> | ||
#include <ecal/config/logging.h> | ||
#include <ecal/ecal_os.h> | ||
#include <ecal/types/ecal_custom_data_types.h> | ||
|
||
#include <stdint.h> | ||
#include <string> | ||
#include <cstddef> | ||
#include <nanobind/nanobind.h> | ||
|
||
namespace eCAL | ||
{ | ||
namespace Logging | ||
{ | ||
namespace Sinks | ||
{ | ||
namespace Console | ||
{ | ||
struct CNBConsoleConfiguration | ||
{ | ||
bool enable{ true }; //!< Enable console logging (Default: true) | ||
eCAL_Logging_Filter filter_log_con{ log_level_error | log_level_fatal }; /*!< Log messages logged to console (all, info, warning, error, fatal, debug1, debug2, debug3, debug4) | ||
(Default: info, warning, error, fatal)*/ | ||
}; | ||
} | ||
|
||
namespace File | ||
{ | ||
struct CNBFileConfiguration | ||
{ | ||
bool enable{ false }; //!< Enable file logging (Default: false) | ||
std::string path{ "" }; //!< Path to log file (Default: "") | ||
eCAL_Logging_Filter filter_log_file{ log_level_none }; /*!< Log messages logged into file system (all, info, warning, error, fatal, debug1, debug2, debug3, debug4) | ||
(Default: info, warning, error, fatal)*/ | ||
}; | ||
} | ||
|
||
namespace UDP | ||
{ | ||
struct CNBUDPConfiguration | ||
{ | ||
bool enable{ true }; //!< Enable UDP logging (Default: false) | ||
unsigned int port{ 14001 }; //!< UDP port number (Default: 14001) | ||
eCAL_Logging_Filter filter_log_udp{ log_level_default }; //!< Log messages logged via udp network (Default: info, warning, error, fatal) | ||
}; | ||
} | ||
|
||
struct CNBSinksConfiguration | ||
{ | ||
// CNBLoggingConfiguration(); | ||
|
||
Console::CNBConsoleConfiguration console; | ||
File::CNBFileConfiguration file; | ||
UDP::CNBUDPConfiguration udp; | ||
}; | ||
} | ||
|
||
struct CNBLoggingConfiguration | ||
{ | ||
Sinks::Configuration sinks; | ||
}; | ||
} | ||
} |