@@ -225,6 +225,12 @@ module Faraday
225225 end
226226
227227 class Response
228+ class Logger < Middleware
229+ def initialize : (untyped app, ?untyped logger, ?::Hash[Symbol, untyped ] options) ?{ (Logging::Formatter formatter) -> void } -> void
230+ def call : (Env env) -> untyped
231+ def on_complete : (Env env) -> void
232+ end
233+
228234 def status : () -> Integer
229235 def headers : () -> untyped
230236 def body : () -> String
@@ -264,6 +270,42 @@ module Faraday
264270 def close : () -> void
265271 end
266272
273+ module Logging
274+ class Formatter
275+ extend Forwardable
276+
277+ DEFAULT_OPTIONS: ::Hash[Symbol, untyped ]
278+
279+ @logger: untyped
280+ @options: ::Hash[Symbol, untyped ]
281+ @filter: ::Array[[untyped , untyped ]]
282+
283+ def initialize : (logger: untyped , options: ::Hash[Symbol, untyped ]) -> void
284+
285+ def debug : (?untyped progname) ?{ () -> untyped } -> untyped
286+ def info : (?untyped progname) ?{ () -> untyped } -> untyped
287+ def warn : (?untyped progname) ?{ () -> untyped } -> untyped
288+ def error : (?untyped progname) ?{ () -> untyped } -> untyped
289+ def fatal : (?untyped progname) ?{ () -> untyped } -> untyped
290+
291+ def request : (Env env) -> void
292+ def response : (Env env) -> void
293+ def filter : (untyped filter_word, untyped filter_replacement) -> void
294+
295+ private
296+
297+ def dump_headers : (untyped headers) -> String
298+ def dump_body : (untyped body) -> String
299+ def pretty_inspect : (untyped body) -> String
300+ def log_headers? : (String | Symbol type ) -> boolish
301+ def log_body? : (String | Symbol type ) -> boolish
302+ def apply_filters : (untyped output) -> String
303+ def log_level : () -> Symbol
304+ def log_headers : (String type , untyped headers) -> untyped
305+ def log_body : (String type , untyped body) -> untyped
306+ end
307+ end
308+
267309 module MiddlewareRegistry
268310 def registered_middleware : () -> Hash[Symbol, untyped ]
269311 def register_middleware : (**untyped mappings) -> void
@@ -329,5 +371,8 @@ module Faraday
329371 attr_accessor response_body: untyped
330372
331373 alias body request_body
374+
375+ def [] : (untyped key) -> untyped
376+ def []= : (untyped key, untyped value) -> untyped
332377 end
333378end
0 commit comments