private fun appendIfNotNull(source: StringBuilder,addStr: String?,delimiter: String): StringBuilder? {var delimiter: String? = delimiter if (addStr != null) {if (addStr.length == 0) {delimiter = ""}return source.append(addStr).append(delimiter)}return source}
Takes a string and adds to it , with a separator , if the bit to be added is n't null . Since the logger takes so many arguments that might be null , this method helps cut out some of the agonizing tedium of writing the same 3 lines over and over .