pax_global_header00006660000000000000000000000064136210513560014514gustar00rootroot0000000000000052 comment=e013a82a8b68841827a0b69f5ff6521c8e9d9d61 rosconsole_bridge-0.5.4/000077500000000000000000000000001362105135600152245ustar00rootroot00000000000000rosconsole_bridge-0.5.4/CHANGELOG.rst000066400000000000000000000070471362105135600172550ustar00rootroot00000000000000^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package rosconsole_bridge ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0.5.4 (2020-02-12) ------------------ * Bump CMake version to avoid CMP0048 warning (`#18 `_) 0.5.3 (2019-03-04) ------------------ * enable Windows build (`#17 `_) 0.5.2 (2018-08-03) ------------------ * fix static destruction ordering issue on macOS (`#16 `_) 0.5.1 (2017-11-05) ------------------ * fix use of deprecated logging functions (`#15 `_, regression of 0.5.0) 0.5.0 (2017-10-25) ------------------ * replace usage of deprecated logging functions (`#14 `_) 0.4.3 (2016-03-11) ------------------ * use catkin variables for install dirs (`#9 `_) 0.4.2 (2014-07-18) ------------------ * update maintainers 0.4.1 (2014-06-25) ------------------ * update find_package for console bridge to reflect 3rdparty status (`#8 `_) 0.4.0 (2014-06-24) ------------------ * rename variables within rosconsole macros (`ros/ros_comm#442 `_) * convert to use console bridge from upstream debian package (`ros/rosdistro#4633 `_) 0.3.4 (2014-02-15) ------------------ * Allows non-ros components to utilize the prefix functionality of log4j * Contributors: Dave Coleman, Ioan A Sucan 0.3.3 (2013-08-21) ------------------ * fixing catkin as a buildtool dependency * Contributors: Dirk Thomas, Tully Foote 0.3.2 (2013-04-12) ------------------ * changes due to renames in console_bridge * Contributors: Ioan Sucan 0.3.1 (2013-03-13 21:24) ------------------------ * fix deps * update e-mail address * Contributors: Ioan Sucan 0.3.0 (2013-03-13 19:39) ------------------------ 0.2.7 (2013-06-12) ------------------ * changes due to renames in console_bridge * Create README.md * Updated package xml to be more compliant to spec as well as adding maintainer * Contributors: Ioan Sucan, Mirza Shah, isucan 0.2.6 (2012-12-10) ------------------ * update log level * Fixing style issues in CMakeLists.txt * Contributors: Ioan Sucan, William Woodall 0.2.5 (2012-12-05) ------------------ * Update cmake to pass along console_bridge Also changed it to depend on console_bridge like a catkin dependency. * Added tag 0.2.4 for changeset e9f39dd361bf * Contributors: Ioan Sucan, William Woodall, isucan 0.2.4 (2012-10-18) ------------------ * updates to package.xml * Added tag 0.2.3 for changeset 63015a123bb7 * Contributors: Ioan Sucan, Tully Foote 0.2.3 (2012-10-06 23:24) ------------------------ * removing outdated install rule * Added tag 0.2.2 for changeset 3fb270551aee * Contributors: Tully Foote 0.2.2 (2012-10-06 18:49) ------------------------ * fixing depend tags * Added tag 0.2.1 for changeset d4cfe2aea73d * Contributors: Tully Foote 0.2.1 (2012-10-06 16:59) ------------------------ * converting to package.xml from stack.xml, and dropping manifest * Added tag 0.2.0 for changeset 25da297e8ddb * Contributors: Ioan Sucan, Tully Foote 0.2.0 (2012-09-02) ------------------ * update stack version * patches for groovy * Added tag fuerte for changeset f05a07a4dc8c * Added tag 0.1.0 for changeset 119bd5db978d * Contributors: Ioan Sucan 0.1.0 (2012-07-02 11:15) ------------------------ * first commit * Contributors: Ioan Sucan rosconsole_bridge-0.5.4/CMakeLists.txt000066400000000000000000000016601362105135600177670ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.0.2) project(rosconsole_bridge) find_package(console_bridge REQUIRED) find_package(catkin REQUIRED COMPONENTS cpp_common rosconsole) include_directories(include ${catkin_INCLUDE_DIRS} ${console_bridge_INCLUDE_DIRS}) link_directories(${catkin_LIBRARY_DIRS} ${console_bridge_LIBRARY_DIRS}) catkin_package( INCLUDE_DIRS include LIBRARIES ${PROJECT_NAME} CATKIN_DEPENDS rosconsole DEPENDS console_bridge ) add_library(${PROJECT_NAME} src/bridge.cpp) target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${console_bridge_LIBRARIES}) install( TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} ) install( DIRECTORY include/${PROJECT_NAME}/ DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}) if(CATKIN_ENABLE_TESTING) add_subdirectory(test) endif() rosconsole_bridge-0.5.4/README.md000066400000000000000000000002151362105135600165010ustar00rootroot00000000000000rosconsole_bridge ================= Pipes console_bridge output to rosconsole/rosout when console_bridge is used in a ROS-dependent package rosconsole_bridge-0.5.4/include/000077500000000000000000000000001362105135600166475ustar00rootroot00000000000000rosconsole_bridge-0.5.4/include/rosconsole_bridge/000077500000000000000000000000001362105135600223515ustar00rootroot00000000000000rosconsole_bridge-0.5.4/include/rosconsole_bridge/bridge.h000066400000000000000000000054571362105135600237710ustar00rootroot00000000000000/********************************************************************* * Software License Agreement (BSD License) * * Copyright (c) 2011, Willow Garage, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of the Willow Garage nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. *********************************************************************/ /* Author: Ioan Sucan */ #ifndef ROSCONSOLE_BRIDGE_ #define ROSCONSOLE_BRIDGE_ #include #include #ifdef ROS_BUILD_SHARED_LIBS // ros is being built around shared libraries #ifdef rosconsole_bridge_EXPORTS // we are building a shared lib/dll #define ROSCONSOLE_BRIDGE_DECL ROS_HELPER_EXPORT #else // we are using shared lib/dll #define ROSCONSOLE_BRIDGE_DECL ROS_HELPER_IMPORT #endif #else // ros is being built around static libraries #define ROSCONSOLE_BRIDGE_DECL #endif namespace rosconsole_bridge { class OutputHandlerROS : public console_bridge::OutputHandler { public: OutputHandlerROS(void); virtual void log(const std::string &text, console_bridge::LogLevel level, const char *filename, int line); }; struct ROSCONSOLE_BRIDGE_DECL RegisterOutputHandlerProxy { RegisterOutputHandlerProxy(void); ~RegisterOutputHandlerProxy(); }; } #define REGISTER_ROSCONSOLE_BRIDGE \ static rosconsole_bridge::RegisterOutputHandlerProxy __register_rosconsole_output_handler_proxy #endif rosconsole_bridge-0.5.4/package.xml000066400000000000000000000017701362105135600173460ustar00rootroot00000000000000 rosconsole_bridge 0.5.4 rosconsole_bridge is a package used in conjunction with console_bridge and rosconsole for connecting console_bridge-based logging to rosconsole-based logging. Ioan Sucan Dirk Thomas Ioan Sucan BSD http://www.ros.org/wiki/rosconsole_bridge https://github.com/ros/rosconsole_bridge/issues https://github.com/ros/rosconsole_bridge catkin cpp_common libconsole-bridge-dev rosconsole cpp_common libconsole-bridge-dev rosconsole rosconsole_bridge-0.5.4/src/000077500000000000000000000000001362105135600160135ustar00rootroot00000000000000rosconsole_bridge-0.5.4/src/bridge.cpp000066400000000000000000000121401362105135600177510ustar00rootroot00000000000000/********************************************************************* * Software License Agreement (BSD License) * * Copyright (c) 2011, Willow Garage, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of the Willow Garage nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. *********************************************************************/ /* Author: Ioan Sucan */ #include #include #include "rosconsole_bridge/bridge.h" namespace rosconsole_bridge { OutputHandlerROS::OutputHandlerROS(void) : OutputHandler() { } void OutputHandlerROS::log(const std::string &text, console_bridge::LogLevel level, const char *filename, int line) { std::string prefix; // Check for fake subprefix name defined as text output "package.prefix: message" // Rejects something like "foo bar: message" because of the space static const std::string NEEDLE_STRING = ": "; size_t sub_index = text.find(NEEDLE_STRING); size_t space_index = text.find(" "); if (sub_index != std::string::npos && // needle is found sub_index > 0 && // does not start with needle space_index > sub_index && // no spaces before needle (": ") text.length() > space_index + 1) // remaining text is not empty { prefix = std::string(ROSCONSOLE_NAME_PREFIX) + "." + text.substr(0, sub_index); // update the sub_index to allow us to later remove the prefix from the message sub_index += NEEDLE_STRING.length(); } else { prefix = std::string(ROSCONSOLE_NAME_PREFIX) + ".console_bridge"; sub_index = 0; } // Handle different logging levels switch (level) { case console_bridge::CONSOLE_BRIDGE_LOG_INFO: { ROSCONSOLE_DEFINE_LOCATION(true, ::ros::console::levels::Info, prefix); if (ROS_UNLIKELY(__rosconsole_define_location__enabled)) { ::ros::console::print(NULL, __rosconsole_define_location__loc.logger_, __rosconsole_define_location__loc.level_, filename, line, "", "%s", text.substr(sub_index, std::string::npos).c_str()); } } break; case console_bridge::CONSOLE_BRIDGE_LOG_WARN: { ROSCONSOLE_DEFINE_LOCATION(true, ::ros::console::levels::Warn, prefix); if (ROS_UNLIKELY(__rosconsole_define_location__enabled)) { ::ros::console::print(NULL, __rosconsole_define_location__loc.logger_, __rosconsole_define_location__loc.level_, filename, line, "", "%s", text.substr(sub_index, std::string::npos).c_str()); } } break; case console_bridge::CONSOLE_BRIDGE_LOG_ERROR: { ROSCONSOLE_DEFINE_LOCATION(true, ::ros::console::levels::Error, prefix); if (ROS_UNLIKELY(__rosconsole_define_location__enabled)) { ::ros::console::print(NULL, __rosconsole_define_location__loc.logger_, __rosconsole_define_location__loc.level_, filename, line, "", "%s", text.substr(sub_index, std::string::npos).c_str()); } } break; default: // debug { ROSCONSOLE_DEFINE_LOCATION(true, ::ros::console::levels::Debug, prefix); if (ROS_UNLIKELY(__rosconsole_define_location__enabled)) { ::ros::console::print(NULL, __rosconsole_define_location__loc.logger_, __rosconsole_define_location__loc.level_, filename, line, "", "%s", text.substr(sub_index, std::string::npos).c_str()); } } break; } } RegisterOutputHandlerProxy::RegisterOutputHandlerProxy(void) { static OutputHandlerROS oh_ros; console_bridge::useOutputHandler(&oh_ros); // we want the output level to be decided by rosconsole, so we bring all messages to rosconsole console_bridge::setLogLevel(console_bridge::CONSOLE_BRIDGE_LOG_DEBUG); } RegisterOutputHandlerProxy::~RegisterOutputHandlerProxy() { console_bridge::restorePreviousOutputHandler(); } } rosconsole_bridge-0.5.4/test/000077500000000000000000000000001362105135600162035ustar00rootroot00000000000000rosconsole_bridge-0.5.4/test/CMakeLists.txt000066400000000000000000000003071362105135600207430ustar00rootroot00000000000000# How can we ensure that the binary goes to build dir only, not devel dir? add_executable(cleanup cleanup.cpp) target_link_libraries(cleanup rosconsole_bridge) add_test(NAME cleanup COMMAND cleanup) rosconsole_bridge-0.5.4/test/cleanup.cpp000066400000000000000000000012531362105135600203370ustar00rootroot00000000000000#include #include // Remove this when no longer supporting platforms with libconsole-bridge-dev < 0.3.0, // in particular Debian Jessie: https://packages.debian.org/jessie/libconsole-bridge-dev #ifndef CONSOLE_BRIDGE_logWarn #define CONSOLE_BRIDGE_logWarn logWarn #endif struct A { A(const char* hint) { CONSOLE_BRIDGE_logWarn("initializing class: %s", hint); } ~A() { CONSOLE_BRIDGE_logWarn("destroying class"); } }; // destructor of static instance should use the original output handler static A a("static"); REGISTER_ROSCONSOLE_BRIDGE; int main(int argc, char **argv) { A a("local"); return 0; }