Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.

Commit c3e0ce7

Browse files
committed
Usability & doc improvements
1 parent 814f281 commit c3e0ce7

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

lib/akita/har_logger.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,24 @@
66

77
module Akita
88
module HarLogger
9+
# Adds HAR-logging instrumentation to a Rails application by adding to the
10+
# top of the middleware stack.
11+
#
12+
# Params:
13+
# +config+:: the +Rails::Application::Configuration+ associated with the
14+
# Rails application being instrumented.
15+
# +har_file_name:: the name of the HAR file to be produced. If the file
16+
# exists, it will be overwritten.
17+
def self.instrument(config, har_file_name)
18+
config.middleware.unshift(Middleware, har_file_name)
19+
end
20+
921
# Logs HTTP request-response pairs to a HAR file.
1022
#
1123
# Params:
1224
# +app+:: the application to log.
13-
# +out_file_name+:: the name of the HAR file to be produced.
25+
# +out_file_name+:: the name of the HAR file to be produced. If the file
26+
# exists, it will be overwritten.
1427
class Middleware
1528
def initialize(app, out_file_name)
1629
@app = app

0 commit comments

Comments
 (0)