validators
Loguru validators.
Pass objects, strings, bools, etc for evaluation.
Each validator checks for existence (unless none_ok=True),
then type, then value (if a list of allowed values is passed).
validate_compression_str(string=None, none_ok=True)
Validate a Loguru compression string value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
string |
str
|
The compression string to validate |
None
|
none_ok |
bool
|
If |
True
|
Returns
(str): A validated compression string
Source code in src/red_utils/ext/loguru_utils/validators.py
validate_level(level=None, none_ok=False)
Validate a Loguru compression string value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level |
str
|
A log level string |
None
|
none_ok |
bool
|
If |
False
|
Returns
(str): A validated log level string
Source code in src/red_utils/ext/loguru_utils/validators.py
validate_logger(_logger=None, none_ok=False)
Validate a loguru.Logger object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
_logger |
logger
|
A Loguru |
None
|
none_ok |
bool
|
If |
False
|
Returns
(loguru.logger): A validated `loguru.logger`