RAPIDS Logger
rapids-logger is a core logging framework within the RAPIDS ecosystem, built around the high-performance C++ `spdlog` library. Its primary goal is to provide project-specific loggers easily, ensuring that custom logging implementations do not leak `spdlog` or `fmt` symbols, thus allowing safe coexistence of different RAPIDS projects in the same environment. While it has Python bindings for packaging, its direct Python API for general-purpose logging is not extensively documented; it primarily serves as the underlying logging mechanism for other RAPIDS Python libraries like `cuML`. The current version is 0.2.3, and releases align with the broader RAPIDS CalVer (YY.MM.PP) versioning scheme for patch releases.
Common errors
-
ModuleNotFoundError: No module named 'rapids_logger'
cause The `rapids-logger` Python package is not installed in the current environment or the Python environment is not correctly activated.fixInstall the package using `pip install rapids-logger` or `conda install -c rapidsai -c conda-forge rapids-logger`. Ensure your Python environment is correctly activated before running your script. -
TypeError: 'module' object is not callable (when trying to call rapids_logger directly as a logging function)
cause Attempting to use `rapids_logger` as a direct logging function or to instantiate a logger directly, which is not its exposed Python API.fixUnderstand that `rapids-logger` primarily serves as an internal dependency for other RAPIDS Python libraries. Configure logging via the specific RAPIDS library's API or environment variables, rather than trying to directly instantiate a logger from the `rapids_logger` module in Python. Refer to the documentation of the specific RAPIDS library you are using for its logging configuration options.
Warnings
- gotcha rapids-logger is fundamentally a C++ library. While Python bindings and wheels are provided, direct high-level Python API for creating and managing loggers (like Python's built-in `logging` module or `loguru`) is not a primary documented feature. Its Python package primarily facilitates its underlying use within other RAPIDS Python libraries.
- breaking For C++ projects building within the RAPIDS ecosystem, `rapids-logger` has replaced direct dependencies on `spdlog` and `fmt`. Projects that previously linked directly against `spdlog` or `fmt` for logging may need to update their CMake configurations to use `rapids-logger` instead.
- gotcha There is an unrelated CI tool also named 'rapids-logger' which is part of the `gha-tools` repository. Ensure you are referencing the correct `rapidsai/rapids-logger` for the logging framework.
Install
-
pip install rapids-logger -
conda install -c rapidsai -c conda-forge rapids-logger
Imports
- Logger
from rapids_logger import Logger
N/A (Typically used indirectly)
Quickstart
# rapids-logger is primarily a C++ library and its direct Python API for general-purpose logging
# is not a primary documented feature. Python users typically interact with logging
# through other RAPIDS Python libraries (e.g., cuML) that use rapids-logger internally.
#
# Example of configuring logging in cuML (which uses rapids-logger implicitly):
# import cuml
# cuml.accel.install(log_level='debug')
#
# To see if rapids-logger's C++ components are correctly installed and available via Python bindings:
import rapids_logger
print(f"rapids_logger version: {rapids_logger.__version__}")
# Further direct interaction would depend on specific, often undocumented, Python bindings.