protonfs.webui.logtarget module

Where du --gui writes its log: a directory, a file or a character device.

Added in version 3.4.0.

class protonfs.webui.logtarget.LogTarget(kind, path)[source]

Bases: object

A resolved --log destination.

Variables:
  • kind – "dir" (a new file named after the start time inside a directory), "file" (appended to) or "device" (a tty or similar, written directly).

  • path – the file or device to open.

Added in version 3.4.0.

kind: str
open()[source]

Open the destination for writing, creating parent directories for files.

A file that does not exist yet is created with mode 0600; an existing file keeps its mode.

Return type:

TextIO

Returns:

a line-buffered text stream; the caller closes it.

Raises:

OSError – when the destination cannot be created or opened.

path: Path
protonfs.webui.logtarget.default_log_dir()[source]

$XDG_STATE_HOME/protonfs/logs, falling back to ~/.local/state/protonfs/logs.

Return type:

Path

Returns:

the directory (not created).

Added in version 3.4.0.

protonfs.webui.logtarget.resolve_log_target(arg, *, now)[source]

Resolve a --log value into where the GUI server’s log goes.

  • None: a new file in default_log_dir().

  • An existing directory, or a value ending in /: a new file in that directory, named du-gui-<start time>.log (e.g. du-gui-2026-11-13T13-44-05.log).

  • A character device (/dev/tty, /dev/stderr, …): written to directly.

  • Anything else: a file, appended to and created if missing.

Parameters:
  • arg (str | None) – the --log value, or None for the default.

  • now (datetime) – the process start time, used to name new files.

Return type:

LogTarget

Returns:

the resolved LogTarget (nothing is created until it is opened).

Added in version 3.4.0.