stan icon indicating copy to clipboard operation
stan copied to clipboard

Cleaning up instances of .str().length() for logger.info()

Open AnikaAChowdhury opened this issue 3 years ago • 2 comments

Submission Checklist

  • [ ] Run unit tests: ./runTests.py src/test/unit
  • [ ] Run cpplint: make cpplint
  • [ ] Declare copyright holder and open-source license: see below

Summary

This fixes stan-dev#2577 which is cleaning up code instances that has .str().length() for logger.info(). This cleans up a lot of "if (msg.str().length() > 0)" instances from the code block that follows if (msg.str().length() > 0) logger.info(msg); patterns. However, there are still a lot of instances "if (msg.str().length() > 0)" left because it was connected with another logger implementation beside logger.info(). Therefore, some of the instances of that could not be removed. There were some left in writer.hpp which was not removed. If needed, it could be removed.

Intended Effect

Removes a lot of duplicate codes.

How to Verify

Need to run tests on the existing testing library (In Progress).

Side Effects

Followed @WardBrian's suggestions

Documentation

Copyright and Licensing

Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company):

By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:

  • Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
  • Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

AnikaAChowdhury avatar Jan 29 '22 20:01 AnikaAChowdhury

Hi! I am not sure why the test failed because logger.call_count() not returning the correct count?

AnikaAChowdhury avatar Jan 29 '22 23:01 AnikaAChowdhury

@rok-cesnovar are you able to help with the test failure here?

WardBrian avatar Jan 31 '22 14:01 WardBrian