Logging Utilities
Utilities for configuring and controlling Verifiers logging output.Overview
Theverifiers.utils.logging_utils module provides:
- Centralized logging configuration
- JSON logging support
- Context managers for temporary log level changes
- Formatted output for training/evaluation
Logger Name
"verifiers" logger. Access it via:
Functions
setup_logging
str | None
default:"INFO"
Console logging level (
"DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"). If None, disables logging.str | None
Custom log format string. Defaults to
"%(asctime)s - %(name)s - %(levelname)s - %(message)s".str | None
Date format string. Defaults to
"%Y-%m-%d %H:%M:%S".str | None
Optional path to log file. If specified, logs are written to this file.
str | None
Log level for file handler. If
None, uses same level as console.bool
default:"False"
If
True, output logs as JSON (structured logging).log_level
str | int
New log level (e.g.,
"DEBUG", "WARNING", or logging.DEBUG).quiet_verifiers
WARNING). Useful for suppressing INFO and DEBUG messages during specific operations while still showing warnings and errors.
Returns: Context manager that temporarily sets log level to WARNING.
Example:
print_prompt_completions_sample
list[Messages]
required
List of input prompts (message format).
list[Messages]
required
List of model completions (message format).
list[Error | ErrorInfo | None]
required
List of errors (or
None for successful rollouts).list[float]
required
List of reward scores. If fewer rewards than prompts, pads with
0.0.int
required
Training step number (displayed in panel title).
int
default:"1"
Number of samples to display from the lists.
print_time
0.05→"50ms"30.0→"30s"90.0→"1m 30s"3700.0→"1h 2m"90000.0→"1d 1h"
JSON Logging
JsonFormatter
Example Usage
Basic Setup
Debug Mode
File Logging
Quiet Mode
Production Logging
Temporary Debug
Custom Format
Logging Levels
Detailed information for diagnosing problems. Very verbose.
Confirmation that things are working as expected. Default level.
Indication of potential issues (e.g., deprecated features).
Serious problem that prevented a function from completing.
Very serious error that may cause termination.
Best Practices
1. Set Up Early
2. Use Appropriate Levels
3. Environment-Specific Config
4. Quiet External Libraries
See Also
- Python logging documentation
- Environment - Base environment class