Output a message according to the verbosity level.
All the output messages should pass for this function, if it is necessary, first use write to format the message on a string and then pass the string to ommp_message
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | s |
Message to be printed |
||
integer(kind=ip), | intent(in) | :: | level |
Requested verbosity level |
||
character(len=*), | intent(in), | optional | :: | logpre |
String that explains the type of message, if missing a default type is assigned based on requested verbosity level |
|
integer(kind=ip), | intent(in), | optional | :: | u |
Output unit for the message, if missing, iof_mmpol is used. |
subroutine ommp_message(s, level, logpre, u)
!! Output a message according to the verbosity level.
!! @note All the output messages should pass for this function, if it
!! is necessary, first use write to format the message on a string and
!! then pass the string to [[ommp_message]]
implicit none
character(len=*), intent(in) :: s
!! Message to be printed
character(len=*), intent(in), optional :: logpre
!! String that explains the type of message, if missing a default type
!! is assigned based on requested verbosity level
integer(ip), intent(in) :: level
!! Requested verbosity level
integer(ip), intent(in), optional :: u
!! Output unit for the message, if missing, [[iof_mmpol]] is used.
integer(ip) :: outunit
character(len=12) :: pre
if(level > verbose) return
if(present(u)) then
outunit = u
else
outunit = iof_mmpol
end if
if(present(logpre)) then
write(pre, '(A12)') "["//trim(logpre)//"]"
else
select case(level)
case(OMMP_VERBOSE_LOW)
write(pre, '(A12)') '[warning]'
case(OMMP_VERBOSE_HIGH)
write(pre, '(A12)') '[info]'
case(OMMP_VERBOSE_DEBUG)
write(pre, '(A12)') '[debug]'
end select
end if
write(outunit, '(A6, A12, " ", A)') '[OMMP]', pre, trim(s)
end subroutine ommp_message