algolia / algolia/algoliasearch-client-python

Missing logger

Đang mở
#429 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Discussion Good First Issue
Ngôn ngữ chính
Python
Star
207
Fork
63
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

- 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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách lần theo các điểm vào của tìm kiếm và request trong Python client, sau đó so sánh chúng với hành vi của DebugLogger trong PHP client được mô tả ở đây. Xác định cách inject một logger cụ thể và cách các implementation tùy chỉnh nhận các request event; bổ sung test coverage cho việc bật debug logging và cung cấp một production logger.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
api
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.