Workspace ManagerstableAPI Reference

Choose documentation 3

stable

Current version

stable
English

Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

tmuxp.log.setup_log_file

tmuxp.log.setup_log_file ( log_file: str, level: str = "INFO" ) → None

Attach a file handler to the tmuxp logger.

Examples#

>>> import tempfile, os, logging
>>> f = tempfile.NamedTemporaryFile(suffix=".log", delete=False)
>>> f.close()
>>> setup_log_file(f.name, level="INFO")
>>> tmuxp_logger = logging.getLogger("tmuxp")
>>> tmuxp_logger.handlers = [
... h for h in tmuxp_logger.handlers if not isinstance(h, logging.FileHandler)
... ]
>>> os.unlink(f.name)
Parameters
  • log_file (str) # – Path to the log file.

  • level (str) # – Log level name (e.g. "DEBUG", "INFO"). Selects formatter and sets handler filtering level.

Esc

Type to search.

Reference preview Open reference