Share via


ConsoleWriter Class

Wrapper for file objects to ensure flushing.

Construct a ConsoleWriter.

Constructor

ConsoleWriter(f: TextIO | None = None, show_output: bool = True)

Parameters

Name Description
f

the underlying file stream

Default value: None
show_output
Default value: True

Methods

flush

Flush the underlying file.

print

Write to the underlying file. The file is flushed.

print_run_info

Print the run id and a link to azure portal. For ipython contexts, format it via html.

println

Write to the underlying file. A newline character is also written and the file is flushed.

If the text provided is None, just a new line character will be written.

write

Write directly to the underlying file.

flush

Flush the underlying file.

flush() -> None

print

Write to the underlying file. The file is flushed.

print(text: str, carriage_return: bool = False) -> None

Parameters

Name Description
text
Required

the text to write

carriage_return

Add the carriage return.

Default value: False

print_run_info

Print the run id and a link to azure portal. For ipython contexts, format it via html.

print_run_info(run: Run) -> None

Parameters

Name Description
run
Required

The run to print.

Returns

Type Description

None

println

Write to the underlying file. A newline character is also written and the file is flushed.

If the text provided is None, just a new line character will be written.

println(text: str | None = None) -> None

Parameters

Name Description
text

the text to write

Default value: None

write

Write directly to the underlying file.

write(text: str) -> None

Parameters

Name Description
text
Required

the text to write