subroutine ESMF_LogOpenDefault (filename, keywordEnforcer, &
appendflag, logkindflag, rc)
!
! !ARGUMENTS:
character(len=*), intent(in) :: filename
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
logical, intent(in), optional :: appendflag
type(ESMF_LogKind_Flag), intent(in), optional :: logkindflag
integer, intent(out), optional :: rc
!
! !DESCRIPTION:
! This routine opens a file named {\tt filename} and associates
! it with the default log. When {\tt logkindflag} is set to
! {\tt ESMF\_LOGKIND\_MULTI} the file name is prepended with PET
! number identification. If the incoming default log is already open,
! an error is returned.
!
! The arguments are:
! \begin{description}
! \item [filename]
! Name of DEFAULT log file to be opened.
! \item [{[appendflag]}]
! If the log file exists, setting to {\tt .false.} will set the file position
! to the beginning of the file. Otherwise, new records will be appended to the
! end of the file. If not specified, defaults to {\tt .true.}.
! \item [{[logkindflag]}]
! Set the logkindflag. See section \ref{const:logkindflag} for a list of
! valid options.
! If not specified, defaults to {\tt ESMF\_LOGKIND\_MULTI}.
! \item [{[rc]}]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!
!EOP
integer :: localrc
character(ESMF_MAXSTR) :: errmsg
integer :: errmsg_len
! Initialize return code; assume routine not implemented
if (present (rc)) then
rc=ESMF_FAILURE
endif
call ESMF_LogOpen (ESMF_LogDefault, filename, appendflag=appendflag, &
logkindflag=logkindflag, rc=localrc)
if (localrc /= ESMF_SUCCESS) then
call ESMF_LogRc2Msg (localrc, msg=errmsg, msglen=errmsg_len)
write (ESMF_UtilIOStderr,*) ESMF_METHOD, ': ', errmsg(:errmsg_len)
call ESMF_UtilIOUnitFlush(ESMF_UtilIOStderr, rc=rc)
end if
if (present (rc)) then
rc = localrc
end if
end subroutine ESMF_LogOpenDefault