NVIDIA Holoscan SDK v0.5.1
v0.5.1

Logging

The load_env_log_level() (C++/Python) function loads the logging level from the environment variable HOLOSCAN_LOG_LEVEL (default: INFO).

Copy
Copied!
            

#include <holoscan/holoscan.hpp> int main() { holoscan::load_env_log_level(); // ... return 0; }

Copy
Copied!
            

from holoscan.logger import load_env_log_level def main(): load_env_log_level() # ... if __name__ == "__main__": main()

HOLOSCAN_LOG_LEVEL can be set to one of the following values:

  • TRACE

  • DEBUG

  • INFO

  • WARN

  • ERROR

  • CRITICAL

  • OFF

Copy
Copied!
            

export HOLOSCAN_LOG_LEVEL=TRACE

The C++ API uses the HOLOSCAN_LOG_XXX() macros to log messages in the application. These macros use the fmtlib format string syntax for their format strings.

Users of the Python API should use the built-in logging module to log messages. Users can control the logging of any underlying C++ Operators used via their Python bindings via the functions in the holoscan.logger module. Specifically, calling load_env_log_level() will load the logging level from the HOLOSCAN_LOG_LEVEL environment variable described above. This log level can also be changed at runtime via set_log_level() using the LogLevel() enum class (e.g. set_log_level(LogLevel.WARN)).

© Copyright 2022-2023, NVIDIA. Last updated on Jul 28, 2023.