parquet_set_message_stream Subroutine

public subroutine parquet_set_message_stream(stream)

Sets which stream the library's own messages go to: "stdout" (the factory default) or "stderr". Case-insensitive; anything else aborts.

Read per message, so it takes effect immediately. The usual reason to change it is a program that pipes its own stdout to a data consumer and does not want the library's warnings mixed into that stream.

Only these two values are accepted, and that is a constraint rather than a preference. A Fortran unit number means nothing to the C++ half of this library, which prints three of the warnings and one of the reports itself -- so a knob holding an arbitrary unit could be honoured by the Fortran sites and silently ignored by the C++ ones. Sending messages to a log file is therefore not supported; a shell redirect or the program's own logging covers it.

The error path does not follow this knob at all. An error stop and the C++ side's fatal-error report always go to stderr, and the context lines parquet_emit_error_context prints just before an abort always go to stdout -- see that procedure for why. The explicitly-called print procedures are unaffected too: they keep their own unit= argument and its output_unit default.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: stream

"stdout" | "stderr".


Source Code

    subroutine parquet_set_message_stream(stream)
        character(len=*), intent(in) :: stream !! "stdout" | "stderr".
        character(len=:), allocatable :: tok, expected

        call fold_ascii_lower(trim(stream), tok)
        select case (tok)
        case ("stdout")
            cfg_message_stream = stream_stdout
        case ("stderr")
            cfg_message_stream = stream_stderr
        case default
            call token_list(stream_tokens, expected)
            error stop "parquet_set_message_stream: unknown stream '" // tok // &
                "' (expected one of: " // expected // ")"
        end select
    end subroutine parquet_set_message_stream