An example program using the Logfile unit might appear as follows:
program testLogfile
use Logfile_interface, ONLY: Logfile_init, Logfile_stamp, Logfile_open, Logfile_close
use Driver_interface, ONLY: Driver_initParallel
use RuntimeParameters_interface, ONLY: RuntimeParameters_init
use PhysicalConstants_interface, ONLY: PhysicalConstants_init
implicit none
integer :: i
integer :: log_lun
integer :: myPE, numProcs
logical :: restart, localWrite
call Driver_initParallel(myPE, numProcs) !will initialize MPI
call RuntimeParameters_init(myPE, restart) ! Logfile_init needs runtime parameters
call PhysicalConstants_init(myPE) ! PhysicalConstants information adds to logfile
call Logfile_init(myPE, numProcs) ! will end with Logfile_create(myPE, numProcs)
call Logfile_stamp (myPE, "beginning log file test...", "[programtestLogfile]")
localWrite=.true.
call Logfile_open(log_lun,localWrite) !! open the local logfile
do i = 1, 10
write (log_lun,*) 'i = ', i
enddo
call Logfile_stamp (myPE, "finished logfile test", "[program testLogfile]")
call Logfile_close(myPE, log_lun)
end program testLogfile