intel / ad-rss-lib

Library implementing the Responsibility Sensitive Safety model (RSS) for Autonomous Vehicles
https://intel.github.io/ad-rss-lib/
GNU Lesser General Public License v2.1
336 stars 138 forks source link

Suppress spdlog #126

Closed roshambo919 closed 2 years ago

roshambo919 commented 2 years ago

Thanks for providing this repository open source. I'm trying to ingrate this as a near-real-time safety checker in my own work for some scenario evaluation, so I've built the library with python bindings (I'm a cpp noob). When I execute the safety checks (similar to the python unit tests), I get a boatload of log information from spdlog spit out to the console which clogs up what I really need to see. Is there a way to suppress this at runtime, redirect to another file, or a build flag to accomplish this? Thanks.

berndgassmann commented 2 years ago

Hi, at runtime the logger can be switched off or set to different log levels. See e.g. where this is done: https://github.com/carla-simulator/carla/blob/master/LibCarla/source/carla/rss/RssCheck.cpp#L223

you would have to call: spdlog::set_level(spdlog::level::off); to switch off the log output from ad_rss

and if using ad_rss_map_integration you need to call ::ad::map::access::getLogger()->set_level(spdlog::level::off); ::ad::rss::map::getLogger()->set_level(spdlog::level::off); to switch off the loggers from carla-map library as well as the one from ad::rss::map namespace

directly from python this is not accessible directly tough.

But if you want to have it switched off always, then you could try to add spdlog::set_level(spdlog::level::off);

e.g. at the beginning of the constructor here: https://github.com/intel/ad-rss-lib/blob/master/ad_rss/src/core/RssCheck.cpp#L22

then it's switched off when the RssCheck object is created. Just as a quick idea for this.

roshambo919 commented 2 years ago

Thanks. Sounds like a good plan, but just did it the old fashioned way by commenting out spdlog::info's.