From 131e34ae8de03a9ab425d9e9989cf162b5215b5c Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Sun, 30 Apr 2017 21:48:06 -0400 Subject: [PATCH] nicer formatting of error reporting --- src/IO.f90 | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/IO.f90 b/src/IO.f90 index acac40785..452bc0588 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -14,7 +14,10 @@ module IO private character(len=5), parameter, public :: & IO_EOF = '#EOF#' !< end of file string - + character(len=168), parameter, private :: & + IO_divider = '───────────────────'//& + '───────────────────'//& + '──────────────────' public :: & IO_init, & IO_read, & @@ -1669,32 +1672,34 @@ subroutine IO_error(error_ID,el,ip,g,ext_msg) end select !$OMP CRITICAL (write2out) - write(0,'(/,a)') ' +--------------------------------------------------------+' - write(0,'(a)') ' + error +' - write(0,'(a,i3,a)') ' + ',error_ID,' +' - write(0,'(a)') ' + +' - write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a2,a',max(1,len(trim(msg))),',',& + write(0,'(/,a)') ' ┌'//IO_divider//'┐' + write(0,'(a)') ' │ error │' + write(0,'(a)') ' ├'//IO_divider//'┤' + write(0,'(a,i3,a)') ' │ ',error_ID,' │' + write(0,'(a)') ' │ │' + write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a4,a',max(1,len(trim(msg))),',',& max(1,60-len(trim(msg))-5),'x,a)' - write(0,formatString) '+ ', trim(msg),'+' + write(0,formatString) '│ ',trim(msg),'│' if (present(ext_msg)) then - write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a2,a',max(1,len(trim(ext_msg))),',',& + write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a4,a',max(1,len(trim(ext_msg))),',',& max(1,60-len(trim(ext_msg))-5),'x,a)' - write(0,formatString) '+ ', trim(ext_msg),'+' + write(0,formatString) '│ ',trim(ext_msg),'│' endif if (present(el)) then if (present(ip)) then if (present(g)) then - write(0,'(a13,1x,i9,1x,a2,1x,i2,1x,a5,1x,i4,18x,a1)') ' + at element',el,'IP',ip,'grain',g,'+' + write(0,'(a13,1x,i9,1x,a2,1x,i2,1x,a5,1x,i4,18x,a1)') ' │ at element',el,'IP',ip,'grain',g,'│' else - write(0,'(a13,1x,i9,1x,a2,1x,i2,29x,a1)') ' + at element',el,'IP',ip,'+' + write(0,'(a13,1x,i9,1x,a2,1x,i2,29x,a1)') ' │ at element',el,'IP',ip,'│' endif else - write(0,'(a13,1x,i9,35x,a1)') ' + at element',el,'+' + write(0,'(a13,1x,i9,35x,a1)') ' │ at element',el,'│' endif elseif (present(ip)) then ! now having the meaning of "instance" - write(0,'(a15,1x,i9,33x,a1)') ' + for instance',ip,'+' + write(0,'(a14,1x,i9,34x,a1)') ' │ at instance',ip,'│' endif - write(0,'(a)') ' +--------------------------------------------------------+' + write(0,'(a)') ' │ │' + write(0,'(a)') ' └'//IO_divider//'┘' flush(0) call quit(9000_pInt+error_ID) !$OMP END CRITICAL (write2out)