
Public Member Functions | |
| def | configure (cls, color=True, apimode=False) |
| def | debug (cls, text="", *args, **kwargs) |
| def | error (cls, text="", *args, **kwargs) |
| def | flush (cls) |
| def | init_terminal (cls) |
| def | log (cls, level, text="", *args, **kwargs) |
| def | print (cls, text="", *args, **kwargs) |
| def | warn (cls, text="", *args, **kwargs) |
Public Attributes | |
| APIMODE | |
| WIDTH | |
Static Public Attributes | |
| bool | APIMODE = False |
| Whether logging debugs and warnings and raising errors, instead of printing. More... | |
| COLOR = None | |
| Whether using colors in output. More... | |
| DEBUG_END | |
| DEBUG_START | |
| ERROR_END | |
| ERROR_START | |
| dictionary | PRINTS = {} |
| {sys.stdout: number of texts printed, sys.stderr: ..} More... | |
| string | STYLE_ERROR = "\x1b[31m\x1b[2m" |
| string | STYLE_HIGHLIGHT = "\x1b[31m" |
| string | STYLE_LOWLIGHT = "\x1b[38;2;105;105;105m" |
| string | STYLE_RESET = "\x1b(B\x1b[m" |
| string | STYLE_SPECIAL = "\x1b[35m" |
| string | STYLE_SPECIAL2 = "\x1b[36m" |
| string | STYLE_WARN = "\x1b[33m" |
| WARN_END | |
| WARN_START | |
| int | WIDTH = 80 |
| Console width in characters, updated from shutil and curses. More... | |
Private Member Functions | |
| def | _format (cls, text="", *args, **kwargs) |
Private Attributes | |
| _LINEOPEN | |
Static Private Attributes | |
| _COLORFLAG = None | |
| bool | _LINEOPEN = False |
| _UNIQUES = set() | |
Prints to console, supports color output. If configured with `apimode=True`, logs debugs and warnings to logger and raises errors.
|
private |
| def grepros.common.ConsolePrinter.configure | ( | cls, | |
color = True, |
|||
apimode = False |
|||
| ) |
Initializes printer, for terminal output or library mode.
For terminal output, initializes terminal colors, or disables colors if unsupported.
@param color True / False / None for auto-detect from TTY support;
will be disabled if terminal does not support colors
@param apimode whether to log debugs and warnings to logger and raise errors,
instead of printing
| def grepros.common.ConsolePrinter.debug | ( | cls, | |
text = "", |
|||
| * | args, | ||
| ** | kwargs | ||
| ) |
| def grepros.common.ConsolePrinter.error | ( | cls, | |
text = "", |
|||
| * | args, | ||
| ** | kwargs | ||
| ) |
| def grepros.common.ConsolePrinter.flush | ( | cls | ) |
| def grepros.common.ConsolePrinter.init_terminal | ( | cls | ) |
| def grepros.common.ConsolePrinter.log | ( | cls, | |
| level, | |||
text = "", |
|||
| * | args, | ||
| ** | kwargs | ||
| ) |
| def grepros.common.ConsolePrinter.print | ( | cls, | |
text = "", |
|||
| * | args, | ||
| ** | kwargs | ||
| ) |
Prints text, formatted with args and kwargs.
@param __file file object to print to if not sys.stdout
@param __end line end to use if not linefeed "\n"
@param __once whether text should be printed only once
and discarded on any further calls (applies to unformatted text)
| def grepros.common.ConsolePrinter.warn | ( | cls, | |
text = "", |
|||
| * | args, | ||
| ** | kwargs | ||
| ) |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |