Skip to content

Commit 53109cf

Browse files
author
Carl Burkert
committed
Use the optval function in the log_message routine
This commit replaces the if-else-block handling the optional prefix arguments. The colon which was previously appended, if the prefix argument was present, is only appended if the prefix argument contains any characters. Previously, prefix='' would end up getting extended to pref=': '.
1 parent 21e20f0 commit 53109cf

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/stdlib_logger.f90

+2-5
Original file line numberDiff line numberDiff line change
@@ -1147,11 +1147,8 @@ subroutine log_message( self, message, module, procedure, prefix )
11471147
character(:), allocatable :: d_and_t, m_and_p, pref
11481148
character(:), allocatable :: buffer
11491149

1150-
if ( present(prefix) ) then
1151-
pref = prefix // ': '
1152-
else
1153-
pref = ''
1154-
end if
1150+
pref = optval(prefix, '')
1151+
if ( len(pref) > 0 ) pref = pref // ': '
11551152

11561153
if ( self % time_stamp ) then
11571154
d_and_t = time_stamp() // ': '

0 commit comments

Comments
 (0)