algolia / algolia/algoliasearch-client-python
Missing logger
- 主要语言
- Python
- 星标
- 207
- 派生
- 63
- PR 合并指标
- 30 天内没有已合并 PR
描述
- Algolia Client Version: latest
### Description
On the Algolia PHP Client, there is the logger feature that allow us to log what happens when a `search`|or other method is called. By default, there is a debug logger that will `print` the requests that are made by the client:
```php
Algolia\AlgoliaSearch\Logger\DebugLogger::enable();
$index->search('foo'); // Dumps information about the request on the console.
Algolia\AlgoliaSearch\Logger\DebugLogger::disable();
```
Example output on the console:
```
array:3 [
"level" => "debug"
"message" => "Algolia API client: Sending request."
"context" => array:6 [
"body" => array:1 [
"query" => "fo"
]
"headers" => array:4 [
"X-Algolia-Application-Id" => ".."
"X-Algolia-API-Key" => ".."
"User-Agent" => "Algolia for PHP (2.2.6); PHP (7.3.5)"
"Content-Type" => "application/json"
]
"method" => "POST"
"query" => []
"retryNumber" => 1
"host" => "https://..-dsn.algolia.net/1/indexes/contacts/query"
]
]
array:3 [
"level" => "debug"
"message" => "Algolia API client: Host failed."
"context" => array:7 [
"body" => array:1 [
"query" => "fo"
]
"headers" => array:4 [
"X-Algolia-Application-Id" => ".."
"X-Algolia-API-Key" => ".."
"User-Agent" => "Algolia for PHP (2.2.6); PHP (7.3.5)"
"Content-Type" => "application/json"
]
"method" => "POST"
"query" => []
"retryNumber" => 1
"host" => "https://..-dsn.algolia.net/1/indexes/contacts/query"
"description" => "An internal server error occurred on ..-dsn.algolia.net"
]
]
```
This issue addresses that feature, as we don't have a logger on the python client. The idea, would be inject a concrete implementation of the logger on the client, allowing people to use this logger for debug purposes, but also, eventually for production reasons using their own specific logger.
贡献指南
调研方向
首先跟踪 Python 客户端的搜索和请求入口点,然后将其与此处描述的 PHP 客户端 DebugLogger 行为进行比较。定义如何注入具体的 logger,以及自定义实现如何接收请求事件;为启用调试日志记录和提供生产 logger 添加测试覆盖。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- api
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100