jettex.console¶
The console module provides Rich-based terminal output and Python logging integration.
Overview¶
This module is primarily used internally by the CLI, but can also be used programmatically to customize logging behavior when using jettex as a library.
Basic Usage¶
import jettex
# Setup logging with verbose output
jettex.setup_logging(jettex.Verbosity.VERBOSE)
# Now all jettex operations will log debug information
result = jettex.compile_tex("document.tex")
Verbosity Levels¶
from jettex import Verbosity, setup_logging
# Quiet - only errors are shown
setup_logging(Verbosity.QUIET)
# Normal (default) - info, warnings, and errors
setup_logging(Verbosity.NORMAL)
# Verbose - debug messages with timestamps
setup_logging(Verbosity.VERBOSE)
Logging to File¶
from pathlib import Path
from jettex import setup_logging, Verbosity
# Log debug info to a file while showing normal output on console
setup_logging(
verbosity=Verbosity.NORMAL,
log_file=Path("jettex_debug.log")
)
API Reference¶
Verbosity
¶
Bases: IntEnum
Verbosity levels for output.
setup_logging(verbosity=Verbosity.NORMAL, log_file=None)
¶
Configure logging with Rich integration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
verbosity
|
Verbosity
|
Output verbosity level |
NORMAL
|
log_file
|
Optional[Path]
|
Optional path to write debug logs |
None
|
Returns:
| Type | Description |
|---|---|
Logger
|
Configured logger for jettex |
get_logger()
¶
Get the jettex logger, setting up with defaults if needed.
get_console()
¶
Get or create the Rich console instance.
is_quiet()
¶
Check if quiet mode is active.
is_verbose()
¶
Check if verbose mode is active.