-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add logging feature for custom validators
- Loading branch information
Kamil Rybacki
committed
Jul 11, 2024
1 parent
9a0ff51
commit d320779
Showing
4 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
## Few words about logging | ||
|
||
There is a total of 4 logger included in the Phaistos package: | ||
|
||
<!-- TRANSPILATION_LOGGER = phaistos.utils.setup_logger('PHAISTOS (T)') | ||
MANAGER_LOGGER = phaistos.utils.setup_logger('PHAISTOS (M)') | ||
COMPILATION_LOGGER = phaistos.utils.setup_logger('PHAISTOS (C)') | ||
VALIDATION_LOGGER = phaistos.utils.setup_logger('PHAISTOS (V)') --> | ||
|
||
1. **PHAISTOS (T)**: This logger is used by the `Transpiler` class to log messages related to the transpilation process. | ||
2. **PHAISTOS (M)**: This logger is used by the `Manager` class to log messages related to the schema management. | ||
3. **PHAISTOS (C)**: This logger is used by the `Compiler` class to log messages related to the compilation process. | ||
4. **PHAISTOS (V)**: This logger is used by the `Manager` class to log messages related to the validation process i.e. things that happen **inside** custom validators. | ||
|
||
The logging level for all the loggers is set to `INFO` by default. | ||
|
||
Do You want to create a custom logger for Phaistos? You can do it by using the `phaistos.utils.setup_logger` function: | ||
|
||
```python | ||
from phaistos import utils | ||
|
||
logger = utils.setup_logger('MyLogger', level='DEBUG') | ||
``` | ||
|
||
This will create a logger named `MyLogger` with the logging level set to `DEBUG`. You can use this logger to log messages in your custom code. | ||
|
||
**phaistos.utils.setup_logger** | ||
|
||
::: phaistos.utils.setup_logger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters