Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | source | |||
integer, | intent(in) | :: | step | |||
integer, | intent(in) | :: | total |
subroutine log_progress(source, step, total)
! Updates progress bar on stdout as INFO
character(len=*), intent(in) :: source
integer, intent(in) :: step, total
character(len=58), parameter :: &
bar = '==========================================================', &
emp = ' '
integer clen, length
! Only print progress bar if stdout == info
if (master_log%stdout_threshold /= log_info_level) return
! Length of bar - 2*[] - <INFO>
length = len(bar) - len_trim(source) - 2 - 7 - 2
clen = int(length*step/total)
call log_write(master_log%stdout, &
log_format_message(20, source, "["//bar(:clen)//emp(len(emp)-length+clen+1:)//"]", datetime=.false.), &
advance=(step == total), clear=len(bar))
! remember that in progress
if (step /= total) then
log_in_progess = len(bar)
else
log_in_progess = 0
end if
end subroutine log_progress