log_create Function

public function log_create(logfile, stderr_level, stdout_level, logfile_level) result(log)

Arguments

Type IntentOptional AttributesName
character(len=*), intent(in) :: logfile
character(len=*), intent(in), optional :: stderr_level
character(len=*), intent(in), optional :: stdout_level
character(len=*), intent(in), optional :: logfile_level

Return Value type(logger)


Calls

proc~~log_create~~CallsGraph proc~log_create log_create proc~log_str2level log_str2level proc~log_create->proc~log_str2level proc~open_file open_file proc~log_create->proc~open_file proc~log_error log_error proc~open_file->proc~log_error proc~log_message log_message proc~log_error->proc~log_message proc~log_write log_write proc~log_message->proc~log_write proc~log_format_message log_format_message proc~log_message->proc~log_format_message proc~to_string to_string proc~log_write->proc~to_string proc~date_time_str date_time_str proc~log_format_message->proc~date_time_str proc~colourise colourise proc~log_format_message->proc~colourise proc~string_index string_index proc~colourise->proc~string_index

Called by

proc~~log_create~~CalledByGraph proc~log_create log_create proc~output_initialise_user_input output_initialise_user_input proc~output_initialise_user_input->proc~log_create proc~management_initialise management_initialise proc~management_initialise->proc~log_create proc~initialise initialise proc~initialise->proc~output_initialise_user_input proc~initialise->proc~management_initialise program~swim swim program~swim->proc~initialise

Contents

Source Code


Source Code

  function log_create(logfile, stderr_level, stdout_level, logfile_level) result(log)
    type(logger) :: log
    ! Name of the log-file to which output will be written
    character(len=*), intent(in)  :: logfile
    ! Threshold priority, at and above which messages will be written to standard error.
    character(len=*), intent(in), optional :: stderr_level
    ! Threshold priority, at and above which messages will be written to standard out.
    character(len=*), intent(in), optional :: stdout_level
    ! Threshold priority, at and above which messages will be written to the log file.
    character(len=*), intent(in), optional :: logfile_level

    log%logfile = logfile
    if (present(stderr_level)) log%stderr_threshold = log_str2level(stderr_level)
    if (present(stdout_level)) log%stdout_threshold = log_str2level(stdout_level)
    if (present(logfile_level)) log%logfile_threshold = log_str2level(logfile_level)
    ! open file if needed
    if (log%logfile_threshold <= log_error_level) log%fileunit = open_file(logfile, 'w')
  end function log_create