_log module

class pyflyby._log.PyflybyLogger(name, level)
HookCtx(pre, post)
_LEVELS = {'DEBUG': 10, 'ERROR': 40, 'INFO': 20, 'WARNING': 30}
property debug_enabled
property info_enabled
set_level(level)

Set the pyflyby logger’s level to level.

pyflyby._log._PromptToolkitStdoutProxyRawCtx(proxy)

Hack to defeat the “feature” where prompt_toolkit.interface._StdoutProxy(sys.stderr) causes ANSI escape codes to not be written.

class pyflyby._log._PyflybyHandler(level=0)
HookCtx(pre, post)
Enter a context where:
  • pre is called before the first time a log record is emitted during the context, and

  • post is called at the end of the context, if any log records were emitted during the context.

Parameters:
  • pre (callable) – Function to call before the first time something is logged during this context.

  • post (callable) – Function to call before returning from the context, if anything was logged during the context.

_interactive_prefix = '\x1b[0m\x1b[33m[PYFLYBY]\x1b[0m '
_logged_anything_during_context = False
_noninteractive_prefix = '[PYFLYBY] '
_pre_log_function = None
emit(record)

Emit a log record.

pyflyby._log._is_interactive(file)
pyflyby._log._is_ipython()

Returns true if we’re currently running inside IPython.