mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
https://github.com/Textualize/textual/discussions/2161
Groups as of:
ab0de0139c/src/textual/_log.py (L4-L15)
This commit is contained in:
@@ -72,7 +72,7 @@ textual run --dev my_app.py
|
||||
Anything you `print` from your application will be displayed in the console window. Textual will also write log messages to this window which may be helpful when debugging your application.
|
||||
|
||||
|
||||
### Verbosity
|
||||
### Increasing verbosity
|
||||
|
||||
Textual writes log messages to inform you about certain events, such as when the user presses a key or clicks on the terminal. To avoid swamping you with too much information, some events are marked as "verbose" and will be excluded from the logs. If you want to see these log messages, you can add the `-v` switch.
|
||||
|
||||
@@ -80,6 +80,17 @@ Textual writes log messages to inform you about certain events, such as when the
|
||||
textual console -v
|
||||
```
|
||||
|
||||
### Decreasing verbosity
|
||||
|
||||
Log messages are classififed in to groups, and the `-x` flag can be used to **exclude** all message from a group. The groups are: `UNDEFINED`, `EVENT`, `DEBUG`, `INFO`, `WARNING`, `ERROR`, `PRINT`, `SYSTEM`, `LOGGING`. The group a message belongs to is printed after its timestamp.
|
||||
|
||||
Multiple groups may be excluded, for example to exclude everything except warning, errors, and `print` statements:
|
||||
|
||||
```bash
|
||||
textual console -x SYSTEM -x EVENT -x DEBUG -x INFO
|
||||
```
|
||||
|
||||
|
||||
## Textual log
|
||||
|
||||
In addition to simple strings, Textual console supports [Rich](https://rich.readthedocs.io/en/latest/) formatting. To write rich logs, import `log` as follows:
|
||||
|
||||
Reference in New Issue
Block a user