File size: 1,736 Bytes
c59d808
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Logging Example and Configuration

## Logging Features Implemented

### 1. Centralized Logging Configuration
- **File**: `config/logging_config.py`
- **Features**: 
  - Rotating file logs (10MB max, 5 backups)
  - Console and file output
  - Structured format with timestamps, levels, and source location
  - Environment-based configuration

### 2. Service-Level Logging
- **Vector Store Service**: Logs initialization, document loading, provider setup
- **LLM Service**: Logs model setup, question processing, memory operations
- **API Endpoints**: Logs requests, responses, and errors

### 3. Log Levels Used
- **INFO**: Normal operations, successful completions
- **DEBUG**: Detailed operation steps, memory operations
- **WARNING**: Non-critical issues, fallbacks
- **ERROR**: Failures, exceptions (with stack traces)

### 4. Emoji-Coded Log Messages
- πŸš€ Startup/Initialization
- βœ… Success operations
- ❌ Error conditions
- ⚠️ Warning conditions
- πŸ”§ Configuration/Setup
- πŸ’¬ Chat operations
- 🧠 Memory operations
- πŸ“Š Database operations
- πŸ” Search/Retrieval
- πŸ’Ύ Storage operations

## Usage Examples

```python
from config.logging_config import get_logger

# Get a logger for your module
logger = get_logger("my_module")

# Log at different levels
logger.info("βœ… Operation completed successfully")
logger.warning("⚠️ Using fallback configuration")
logger.error("❌ Operation failed", exc_info=True)  # Includes stack trace
```

## Log File Location
- **Path**: `./logs/recipe_bot.log`
- **Rotation**: Automatic when file exceeds 10MB
- **Backups**: Keeps 5 backup files

## Console Output
All logs are also displayed in the console with colored formatting for easy debugging during development.