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
Use environment settings for conditional debugging logic:
177
+
178
+
```python
179
+
from blacksheep import Application
180
+
181
+
app = Application()
182
+
183
+
@app.on_start
184
+
asyncdefconfigure_logging():
185
+
if app.env_settings.show_error_details:
186
+
# Enable verbose logging in development
187
+
import logging
188
+
logging.getLogger().setLevel(logging.DEBUG)
189
+
print("Debug logging enabled due to APP_SHOW_ERROR_DETAILS=true")
190
+
```
191
+
192
+
### Benefits of Runtime Configuration Access
193
+
194
+
1.**Transparency**: Easy inspection of how the application is configured
195
+
2.**Testing**: Reliable assertions about configuration state in tests
196
+
3.**Debugging**: Quick access to configuration values during development
197
+
4.**Monitoring**: Health checks and admin endpoints can expose configuration
198
+
5.**Conditional Logic**: Runtime decisions based on configuration values
199
+
200
+
The `EnvironmentSettings` object is read-only, ensuring that configuration remains stable throughout the application lifecycle while still providing full visibility into the current settings.
201
+
61
202
### Configuring exceptions handlers
62
203
63
204
The BlackSheep `Application` object has an `exceptions_handlers` dictionary
0 commit comments