Skip to content

Commit

Permalink
Add onlyErrors parametter to getLogs
Browse files Browse the repository at this point in the history
  • Loading branch information
Xavier Grand committed Mar 19, 2014
1 parent f2e7639 commit 3f83b4c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/com/algolia/search/saas/APIClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,15 @@ public JSONObject getLogs(int offset, int length) throws AlgoliaException {
return getRequest("/1/logs?offset=" + offset + "&length=" + length);
}

/**
* Return last logs entries.
* @param offset Specify the first entry to retrieve (0-based, 0 is the most recent log entry).
* @param length Specify the maximum number of entries to retrieve starting at offset. Maximum allowed value: 1000.
*/
public JSONObject getLogs(int offset, int length, boolean onlyErrors) throws AlgoliaException {
return getRequest("/1/logs?offset=" + offset + "&length=" + length + "&onlyErrors=" + onlyErrors);
}

/**
* Get the index object initialized (no server call needed for initialization)
*
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/com/algolia/search/saas/SimpleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,8 @@ public void test23_logs() throws AlgoliaException, JSONException {
assertTrue(res.getJSONArray("logs").length() > 0);
res = client.getLogs(0, 1);
assertTrue(res.getJSONArray("logs").length() == 1);
res = client.getLogs(0, 1, false);
assertTrue(res.getJSONArray("logs").length() == 1);
}

@Test
Expand Down

0 comments on commit 3f83b4c

Please sign in to comment.