You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# config.logger = Rails.logger # When set the file and level settings are not used.
89
90
config.log_file ='/logs/ruby_llm.log'
90
91
config.log_level =:debug# debug level can also be set to debug by setting RUBYLLM_DEBUG envar to true
91
92
config.log_assume_model_exists =false# Silence "Assuming model exists for provider" warning
@@ -158,13 +159,16 @@ Fine-tune how RubyLLM handles HTTP connections and retries.
158
159
Adjust these based on network conditions and provider reliability.
159
160
160
161
## Logging Settings
161
-
RubyLLM provides flexible logging configuration to help you monitor and debug API interactions. You can configure both the log file location and the logging level.
162
+
RubyLLM provides flexible logging configuration to help you monitor and debug API interactions. You can configure both the log file location and the logging level, or set a custom logger.
162
163
163
164
```ruby
164
165
RubyLLM.configure do |config|
165
166
# --- Logging Settings ---
166
167
config.log_file ='/logs/ruby_llm.log'# Path to log file (default: nil, logs to STDOUT)
You can also set the debug level by setting the `RUBYLLM_DEBUG` environment variable to `true`.
183
187
188
+
### Custom Logger
189
+
190
+
*`config.logger`: Specifies a custom `Logger` for where logs should be written.
191
+
192
+
{: .note }
193
+
If you set a customer logger the `config.log_file` and `config.log_level`
194
+
settings are not used.
195
+
184
196
## Scoped Configuration with Contexts
185
197
186
198
While `RubyLLM.configure` sets global defaults, `RubyLLM.context` allows you to create temporary, isolated configuration scopes for specific API calls. This is ideal for situations requiring different keys, endpoints, or timeouts temporarily without affecting the rest of the application.
0 commit comments