algolia / algolia/algoliasearch-client-python

Missing logger

Offen
#429 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Discussion Good First Issue
Vorherrschende Sprache
Python
Sterne
207
Forks
63
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne damit, die Search- und Request-Einstiegspunkte des Python-Clients nachzuverfolgen, und vergleiche sie anschließend mit dem hier beschriebenen Verhalten von DebugLogger im PHP-Client. Lege fest, wie ein konkreter Logger injiziert wird und wie benutzerdefinierte Implementierungen Request-Ereignisse empfangen; füge Testabdeckung für das Aktivieren des Debug-Loggings und das Bereitstellen eines Production-Loggers hinzu.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
api
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.