Commit 3ff248a
Improve UDF logging options (#88)
* Update docs
* feat(functions): refactor logging configuration for UDF applications
- Add log_file, log_format, and log_level parameters to Application class
- Move logging configuration from main() to Application.__init__() via _configure_logging()
- Add external_function.log_file and external_function.log_format config options
- Update Application docstring to document all parameters including logging
- Refactor Timer.finish() to return metrics dict instead of logging directly
- Configure uvicorn logging to use same log file when specified
This refactoring centralizes logging configuration and allows for more flexible
UDF application logging through configuration parameters.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Add disable_metrics option to external functions
- Add external_function.disable_metrics configuration option (default: False)
- Add disable_metrics parameter to Application class constructor
- Update Application to create logger-specific instances with unique names
- Add --disable-metrics command-line argument to main function
- Conditionally log metrics based on disable_metrics flag
- Support configuration via environment variable SINGLESTOREDB_EXT_FUNC_DISABLE_METRICS
This allows users to disable the logging of function call metrics when needed,
while maintaining backward compatibility with existing behavior.
* refactor(functions): remove log_format config, add app_name parameter
- Remove external_function.log_format configuration option and --log-format CLI flag
- Standardize on JSON formatted logging for all external function applications
- Add external_function.app_name configuration option with --app-name CLI flag
- Change Application class constructor parameter from 'name=' to 'app_name=' for consistency
- Update logging configuration to use JSON formatter for both console and file output
- Improve structured logging with additional context fields (app_name, request_id, etc.)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Propagate log level to UDF app
* feat: add get_uvicorn_log_config method to Application class
- Move uvicorn log config creation from main() into a reusable method
- Allow external users to match the Application's logging format
- Simplify main() by using the new method
- Uses the same JSON formatter and settings as Application's internal logging
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 202a5bf commit 3ff248a
File tree
5 files changed
+291
-42
lines changed- singlestoredb
- apps
- functions/ext
5 files changed
+291
-42
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
51 | 56 | | |
52 | 57 | | |
53 | 58 | | |
| |||
60 | 65 | | |
61 | 66 | | |
62 | 67 | | |
63 | | - | |
| 68 | + | |
64 | 69 | | |
65 | 70 | | |
66 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
410 | 416 | | |
411 | 417 | | |
412 | 418 | | |
| |||
450 | 456 | | |
451 | 457 | | |
452 | 458 | | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
453 | 471 | | |
454 | 472 | | |
455 | 473 | | |
| |||
0 commit comments