Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing logger #429

Open
nunomaduro opened this issue Jun 24, 2019 · 0 comments
Open

Missing logger #429

nunomaduro opened this issue Jun 24, 2019 · 0 comments

Comments

@nunomaduro
Copy link

  • 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:

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant