factor out a logging method for WEB-8850 +review WEBCR-186
add a docblock for WEB-8850 +review WEBCR-186
fix bugs and remove test code for WEB-8850 +review WEBCR-186