cmeel-console-bridge
cmeel-console-bridge is a cmeel distribution for `console-bridge`, a ROS-independent C++ logging package. It provides logging calls that mirror those found in `rosconsole` but for applications that do not necessarily use ROS. This package is currently at version 1.0.2.3 and receives regular updates.
Common errors
-
ModuleNotFoundError: No module named 'console_bridge'
cause The `cmeel-console-bridge` package was either not installed, or the Python environment where it was installed is not active. Sometimes, `pip` might report success but the installation is corrupted, or a `cmeel.pth` file issue.fixEnsure the package is installed in the active environment: `pip install cmeel-console-bridge`. If you're using virtual environments, activate the correct one. If the issue persists, try reinstalling with `--no-cache-dir`. -
CMake Error at CMakeLists.txt:2 (project): No CMAKE_C_COMPILER could be found.
cause During installation, `pip` attempted to build `cmeel-console-bridge` from source because a pre-built wheel was not found for your system. This error indicates that a C++ compiler (like GCC or Clang) is missing or not detectable by CMake.fixInstall a C++ compiler for your operating system. For Debian/Ubuntu, run `sudo apt-get update && sudo apt-get install build-essential cmake`. For macOS, install Xcode Command Line Tools (`xcode-select --install`). For Windows, install Visual Studio with C++ build tools.
Warnings
- gotcha Direct exposure of C++ logging functions: Unlike standard Python logging, `cmeel-console-bridge` exposes C++-style logging functions (e.g., `logInform`, `logDebug`) directly within the `console_bridge` module. It does not integrate with Python's built-in `logging` module.
- breaking Python 3.8 is the minimum required version. Older Python environments will fail installation.
- gotcha Source installation requires C++ compilers and CMake: If a pre-built wheel is not available for your specific platform and Python version, `pip` will attempt to build from source. This requires a C++ compiler (e.g., GCC, MSVC) and CMake to be installed and correctly configured in your environment.
Install
-
pip install cmeel-console-bridge
Imports
- logInform
import logging logging.info("Hello from standard logging!")import console_bridge console_bridge.logInform("Hello from console_bridge!") - logDebug
import console_bridge console_bridge.logDebug("Debugging info.")
Quickstart
import console_bridge
# Set the logging level (optional, default might be INFO or higher)
# console_bridge.setLogLevel(console_bridge.CONSOLE_BRIDGE_LOG_DEBUG)
console_bridge.logDebug("This is a debug message.")
console_bridge.logInform("This is an informational message.")
console_bridge.logWarn("This is a warning message.")
console_bridge.logError("This is an error message.")
# Example of using format strings, similar to C-style printf
name = "World"
value = 42
console_bridge.logInform("Hello, %s! The answer is %d.", name, value)