open_log_file Subroutine

public subroutine open_log_file(logfile_name, io_err)

Opens a new log file for writing

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: logfile_name
integer, intent(inout), optional :: io_err

Source Code

    subroutine open_log_file(logfile_name, io_err)
        !! Opens a new log file for writing
        character(len=*), intent(in) :: logfile_name
        integer, intent(inout), optional :: io_err

        ! Store unit and file name information in module
        log_name = trim(logfile_name)

        ! Open log file
        if (present(io_err)) then
            open(newunit=log_unit, file=log_name, status="replace", iostat=io_err)
        else
            open(newunit=log_unit, file=log_name, status="replace")
        end if
        file_opened = .true.
    end subroutine open_log_file