Class LogInterceptor

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface okhttp3.Interceptor

        okhttp3.Interceptor.Chain
    • Constructor Summary

      Constructors 
      Constructor Description
      LogInterceptor​(Logger logger)
      Creates a LogInterceptor, taking a logger to be logged to, once a request comes in.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      okhttp3.Response intercept​(okhttp3.Interceptor.Chain chain)
      Log the incoming request.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LogInterceptor

        public LogInterceptor​(Logger logger)
        Creates a LogInterceptor, taking a logger to be logged to, once a request comes in.
        Parameters:
        logger - a nonnull logger to be used.
        Throws:
        java.lang.IllegalArgumentException - if a null logger was given.
    • Method Detail

      • intercept

        public okhttp3.Response intercept​(okhttp3.Interceptor.Chain chain)
                                   throws java.io.IOException
        Log the incoming request.

        Once a request gets triggered in okhttp3, this interceptor gets called.

        Specified by:
        intercept in interface okhttp3.Interceptor
        Parameters:
        chain - the chain of interceptor, provided by the okhttp3.
        Returns:
        the response of the chain.
        Throws:
        java.io.IOException - in case of failure down the line.