private static void writeToLog(int level,long totalNanos,long count,ProfilingTimerNode parent,String taskName,Log log,String logAppendMessage){
  if (log == null) {
    return;
  }
  StringBuilder sb=new StringBuilder();
  for (int i=0; i < level; i++) {
    sb.append('\t');
  }
  String durationText=String.format("%s%s",formatElapsed(totalNanos),count == 1 ? "" : String.format(" across %d invocations, average: %s",count,formatElapsed(totalNanos / count)));
  String text=parent == null ? String.format("total time %s",durationText) : String.format("[%s] took %s",taskName,durationText);
  sb.append(text);
  sb.append(logAppendMessage);
  log.info(sb.toString());
}

private static void writeToLog ( int level , long totalNanos , long count , ProfilingTimerNode parent , String taskName , Log log , String logAppendMessage ) { if ( log == null ) { return ; } StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < level ; i ++ ) { sb . append ( '\t' ) ; } String durationText = String . format ( "%s%s" , formatElapsed ( totalNanos ) , count == 1 ? "" : String . format ( " across %d invocations, average: %s" , count , formatElapsed ( totalNanos / count ) ) ) ; String text = parent == null ? String . format ( "total time %s" , durationText ) : String . format ( "[%s] took %s" , taskName , durationText ) ; sb . append ( text ) ; sb . append ( logAppendMessage ) ; log . info ( sb . toString ( ) ) ; }
writes one profiling line of information to the log
