program main
use fckit_module
character(len=1024) :: msg
character(len=1024) :: filename
call fckit_main%initialise()
! All ranks printing:
write(msg,*) "hello from rank ", fckit_main%taskID()
call fckit_log%info(msg)
! Remove printing for all ranks except 0
if( fckit_main%taskID() /= 0 ) then
call fckit_log%reset()
endif
write(msg,*) "Only rank 0 saying hello";
call fckit_log%info(msg)
! Add printing to file per rank
write(filename,'(A,I0)') "log.p", fckit_main%taskID()
call fckit_log%add_file(filename)
write(msg,*) "Everybody writing this line to file";
call fckit_log%info(msg)
call fckit_main%finalise()
end program |