Commit e5b556a
Add support for logging to file via configuration (#148)
## Purpose
Introduces some basic configuration for the logging capabilities,
allowing users to specify a custom log file and log level. This feature
enhances debugging and monitoring capabilities by providing more control
over where and how logs are recorded.
## Implementation Details
- Added log_file configuration option (default: STDOUT)
- Added log_level configuration option (default: INFO, or DEBUG if
RUBYLLM_DEBUG env var is set)
- Updated logger initialisation to use the configured log file and level
- Added documentation for logging configuration
- Maintained backward compatibility with existing logging behaviour
## Usage Example
```ruby
# Global configuration
RubyLLM.configure do |config|
config.log_file = '/logs/ruby_llm.log' # Custom log file location
config.log_level = :debug # Set log level
end
```
## Testing
Manual
- Verified logger initialisation with custom log file
- Confirmed log level changes based on configuration
- Tested environment variable override for debug level
- Validated default behaviour (STDOUT logging)
## Documentation
Added a new section in configuration.md for logging settings
Co-authored-by: Carmine Paolino <carmine@paolino.me>1 parent faf737d commit e5b556a
File tree
3 files changed
+42
-4
lines changed- docs
- lib
- ruby_llm
3 files changed
+42
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
78 | 83 | | |
79 | 84 | | |
80 | 85 | | |
| |||
134 | 139 | | |
135 | 140 | | |
136 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
137 | 167 | | |
138 | 168 | | |
139 | 169 | | |
| |||
178 | 208 | | |
179 | 209 | | |
180 | 210 | | |
181 | | - | |
| 211 | + | |
| 212 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
48 | 55 | | |
49 | 56 | | |
50 | 57 | | |
| |||
0 commit comments