Skip to content

Commit 917adb9

Browse files
authored
Merge pull request #252 from jvdp1/issues
Issue with logger s configuration subroutine
2 parents eec1c0e + 2672af9 commit 917adb9

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

doc/specs/stdlib_logger.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ Pure subroutine
309309
`log_units` (optional): shall be a rank one allocatable array
310310
variable of type default integer. It is an `intent(out)`
311311
argument. On return it shall be the elements of the `self`'s `log_units`
312-
array.
312+
array. If there were no elements in `self`'s `log_units`, a
313+
zero-sized array is returned.
313314

314315
#### Example
315316

src/stdlib_logger.f90

+5-1
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,11 @@ pure subroutine configuration( self, add_blank_line, indent, &
434434
if ( present(indent) ) indent = self % indent_lines
435435
if ( present(max_width) ) max_width = self % max_width
436436
if ( present(time_stamp) ) time_stamp = self % time_stamp
437-
if ( present(log_units) ) log_units = self % log_units(1:self % units)
437+
if ( present(log_units) .and. self % units .gt. 0 ) then
438+
log_units = self % log_units(1:self % units)
439+
else
440+
allocate(log_units(0))
441+
end if
438442

439443
end subroutine configuration
440444

0 commit comments

Comments
 (0)