Subroutine to print error header
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | iounit | I/O unit to write error to |
||
character(len=*), | intent(in) | :: | source_file | Source file where the error was issued |
||
integer, | intent(in) | :: | line_num | Line number at which the error was issued |
subroutine write_error_header(iounit, source_file, line_num)
!> I/O unit to write error to
integer, intent(in) :: iounit
!> Source file where the error was issued
character(len=*), intent(in) :: source_file
!> Line number at which the error was issued
integer, intent(in) :: line_num
integer :: ios
write(unit=iounit, fmt=*) "--------------------------------------------------------------"
write(unit=iounit, fmt=*, iostat=ios) "Program ", PROJECT_NAME, " version: ", PROJECT_VER
write(unit=iounit, fmt=*, iostat=ios) "Process ID: ", process_id
write(unit=iounit, fmt="('Encountered an error in file: ',A,' line: ',i0)", iostat=ios) &
source_file, line_num
write(unit=iounit, fmt=*) "--------------------------------------------------------------"
write(unit=iounit, fmt=*)
write(unit=iounit, fmt=*, iostat=ios) "Error message:"
end subroutine write_error_header