adds logging to dev info
This commit is contained in:
parent
389bb57185
commit
5a30b1a784
65
DEVELOPMENT
Normal file
65
DEVELOPMENT
Normal file
@ -0,0 +1,65 @@
|
||||
## How to use the logger
|
||||
|
||||
### GUI Interactions:
|
||||
|
||||
```python
|
||||
ActivityLog.log_gui_interaction(
|
||||
action="view_paper_details",
|
||||
description="User viewed paper details",
|
||||
paper_id=123
|
||||
)
|
||||
```
|
||||
|
||||
### Configuration Changes:
|
||||
|
||||
```python
|
||||
ActivityLog.log_gui_interaction(
|
||||
action="view_paper_details",
|
||||
description="User viewed paper details",
|
||||
paper_id=123
|
||||
)
|
||||
```
|
||||
|
||||
### Scraper Commands:
|
||||
|
||||
```python
|
||||
ActivityLog.log_scraper_command(
|
||||
action="start_scraper",
|
||||
status="running"
|
||||
)
|
||||
```
|
||||
|
||||
### Scraper Activities:
|
||||
|
||||
```python
|
||||
ActivityLog.log_scraper_activity(
|
||||
action="download_paper",
|
||||
paper_id=123,
|
||||
status="success",
|
||||
description="Paper downloaded successfully",
|
||||
file_path="/papers/123.pdf"
|
||||
)
|
||||
```
|
||||
|
||||
### Error Logging:
|
||||
|
||||
```python
|
||||
# Simple error
|
||||
ActivityLog.log_error(
|
||||
error_message="Failed to connect to API",
|
||||
severity=ErrorSeverity.WARNING.value,
|
||||
source="api_client"
|
||||
)
|
||||
|
||||
# Logging an exception
|
||||
try:
|
||||
result = some_risky_operation()
|
||||
except Exception as e:
|
||||
ActivityLog.log_error(
|
||||
error_message="Operation failed",
|
||||
exception=e,
|
||||
severity=ErrorSeverity.ERROR.value,
|
||||
source="data_processor",
|
||||
paper_id=paper_id
|
||||
)
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user