-
Notifications
You must be signed in to change notification settings - Fork 181
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
dca99e2
commit 1d681a7
Showing
12 changed files
with
389 additions
and
517 deletions.
There are no files selected for viewing
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,38 @@ | ||
# ========================= eCAL LICENSE ================================= | ||
# | ||
# Copyright (C) 2016 - 2025 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 ================================= | ||
import ecal.nanobind_core as ecal_core | ||
|
||
|
||
def main(): | ||
ecal_core.initialize('logging', ecal_core.ALL) | ||
|
||
ecal_core.log(ecal_core.LogLevel.INFO, "Hello Hello") | ||
ecal_core.log(ecal_core.LogLevel.WARNING, "Help") | ||
|
||
|
||
all_logging = ecal_core.get_logging() | ||
|
||
for log in all_logging.log_messages: | ||
print(log) | ||
|
||
ecal_core.finalize() | ||
|
||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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
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
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 |
---|---|---|
@@ -1,65 +1,47 @@ | ||
///* ========================= eCAL LICENSE ================================= | ||
// * | ||
// * Copyright (C) 2016 - 2025 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 log.h | ||
// * @brief eCAL logging interface | ||
//**/ | ||
// | ||
//#pragma once | ||
// | ||
//#include <ecal/os.h> | ||
//#include <ecal/log_level.h> | ||
//#include <ecal/types/logging.h> | ||
// | ||
//#include <list> | ||
//#include <string> | ||
// | ||
//namespace eCAL | ||
//{ | ||
// namespace Logging | ||
// { | ||
// /** | ||
// * @brief Log a message. | ||
// * | ||
// * @param level_ The level. | ||
// * @param msg_ The log message string. | ||
// **/ | ||
// ECAL_API void Log(eLogLevel level_, const std::string& msg_); | ||
// | ||
// /** | ||
// * @brief Get logging as serialized protobuf string. | ||
// * | ||
// * @param [out] log_ String to store the logging information. | ||
// * | ||
// * @return True if succeeded. | ||
// **/ | ||
// ECAL_API bool GetLogging(std::string& log_); | ||
// | ||
// /** | ||
// * @brief Get logging as struct. | ||
// * | ||
// * @param [out] log_ Target struct to store the logging information. | ||
// * | ||
// * @return True if succeeded. | ||
// **/ | ||
// ECAL_API bool GetLogging(Logging::SLogging& log_); | ||
// } | ||
//} | ||
// | ||
/* ========================= eCAL LICENSE ================================= | ||
* | ||
* Copyright (C) 2016 - 2025 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 log.h | ||
* @brief eCAL logging interface | ||
**/ | ||
|
||
#include <core/py_log.h> | ||
#include <ecal/log.h> | ||
|
||
#include <optional> | ||
|
||
#include <nanobind/stl/optional.h> | ||
#include <nanobind/stl/string.h> | ||
|
||
namespace nb = nanobind; | ||
using namespace eCAL::Logging; | ||
|
||
void AddLog(nanobind::module_& module) | ||
{ | ||
module.def("log", &Log, "Log a message", nb::arg("level"), nb::arg("message")); | ||
|
||
module.def("get_logging", []() -> std::optional<SLogging> { | ||
SLogging log_output; | ||
if (GetLogging(log_output)) return log_output; | ||
return std::nullopt; | ||
}, "Get logging as Logging | None"); | ||
} | ||
|
||
|
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 |
---|---|---|
@@ -1,65 +1,27 @@ | ||
///* ========================= eCAL LICENSE ================================= | ||
// * | ||
// * Copyright (C) 2016 - 2025 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 log.h | ||
// * @brief eCAL logging interface | ||
//**/ | ||
// | ||
//#pragma once | ||
// | ||
//#include <ecal/os.h> | ||
//#include <ecal/log_level.h> | ||
//#include <ecal/types/logging.h> | ||
// | ||
//#include <list> | ||
//#include <string> | ||
// | ||
//namespace eCAL | ||
//{ | ||
// namespace Logging | ||
// { | ||
// /** | ||
// * @brief Log a message. | ||
// * | ||
// * @param level_ The level. | ||
// * @param msg_ The log message string. | ||
// **/ | ||
// ECAL_API void Log(eLogLevel level_, const std::string& msg_); | ||
// | ||
// /** | ||
// * @brief Get logging as serialized protobuf string. | ||
// * | ||
// * @param [out] log_ String to store the logging information. | ||
// * | ||
// * @return True if succeeded. | ||
// **/ | ||
// ECAL_API bool GetLogging(std::string& log_); | ||
// | ||
// /** | ||
// * @brief Get logging as struct. | ||
// * | ||
// * @param [out] log_ Target struct to store the logging information. | ||
// * | ||
// * @return True if succeeded. | ||
// **/ | ||
// ECAL_API bool GetLogging(Logging::SLogging& log_); | ||
// } | ||
//} | ||
// | ||
/* ========================= eCAL LICENSE ================================= | ||
* | ||
* Copyright (C) 2016 - 2025 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 log.h | ||
* @brief eCAL logging interface | ||
**/ | ||
|
||
#include <nanobind/nanobind.h> | ||
|
||
void AddLog(nanobind::module_& module); |
Oops, something went wrong.