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

tmuxp.log.setup_log_file

Python
  • Python
  • Ruby Unavailable
  • Lua Unavailable
  • TypeScript Unavailable
  • Rust Unavailable
  • Go Unavailable
  • Java Unavailable
  • .NET Unavailable
  • C++ Unavailable
  • Swift Unavailable

API reference · Markdown

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

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.