Skip to content

Commit

Permalink
more readme updates
Browse files Browse the repository at this point in the history
  • Loading branch information
pbnjay committed Nov 1, 2014
1 parent fdf61e4 commit 8190806
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ First, convert your existing http.Client instance (or http.DefaultClient) to
a harhar.Client:

// before
webClient := &http.Client{}
webClient := &http.Client{}

// after
httpClient := &http.Client{}
webClient := harhar.NewClient(httpClient)
// after
httpClient := &http.Client{}
webClient := harhar.NewClient(httpClient)

Then, whenever you're ready to generate the HAR output, call WriteLog:

Expand All @@ -32,8 +32,9 @@ Optional periodic logging
-------------------------

To dynamically enable or disable HAR logging, code can use harhar.ClientInterface
to represent either an http.Client or harhar.Client. When using this interface,
you can write logs (if enabled) by using this simple block of code:
to represent either an http.Client or harhar.Client. The included `harhar` example
command shows one way to use this interface. When using this interface, you can
write logs (if enabled) by using this simple block of code:

if harCli, ok := myClient.(*harhar.Client); ok {
harCli.WriteLog("output.har")
Expand All @@ -56,3 +57,7 @@ lifetime. An example is the following (never-ending) goroutine:
}
}()

Note that when logging is enabled, harhar memory usage can grow pretty quickly,
especially if Responses are large. If you don't want to disable logging in code
when output size grows too large, you should at least display it so that users
can decide to stop before the OOM killer comes to play.

0 comments on commit 8190806

Please sign in to comment.