use of feign.Logger in project feign by OpenFeign.
the class WikipediaExample method main.
public static void main(String... args) throws InterruptedException {
Gson gson = new GsonBuilder().registerTypeAdapter(new TypeToken<Response<Page>>() {
}.getType(), pagesAdapter).create();
Wikipedia wikipedia = Feign.builder().decoder(new GsonDecoder(gson)).logger(new Logger.ErrorLogger()).logLevel(Logger.Level.BASIC).target(Wikipedia.class, "https://en.wikipedia.org");
System.out.println("Let's search for PTAL!");
Iterator<Page> pages = lazySearch(wikipedia, "PTAL");
while (pages.hasNext()) {
System.out.println(pages.next().title);
}
}
use of feign.Logger in project feign by OpenFeign.
the class AbstractClientTest method safeRebuffering.
@Test
public void safeRebuffering() throws IOException, InterruptedException {
server.enqueue(new MockResponse().setBody("foo"));
TestInterface api = newBuilder().logger(new Logger() {
@Override
protected void log(String configKey, String format, Object... args) {
}
}).logLevel(// rebuffers the body
Logger.Level.FULL).target(TestInterface.class, "http://localhost:" + server.getPort());
api.post("foo");
}
use of feign.Logger in project feign by OpenFeign.
the class AbstractClientTest method safeRebuffering_noContent.
/** This shows that is a no-op or otherwise doesn't cause an NPE when there's no content. */
@Test
public void safeRebuffering_noContent() throws IOException, InterruptedException {
server.enqueue(new MockResponse().setResponseCode(204));
TestInterface api = newBuilder().logger(new Logger() {
@Override
protected void log(String configKey, String format, Object... args) {
}
}).logLevel(// rebuffers the body
Logger.Level.FULL).target(TestInterface.class, "http://localhost:" + server.getPort());
api.post("foo");
}
Aggregations