Skip to content

Commit

Permalink
Minor refactor + README.md file has been added
Browse files Browse the repository at this point in the history
  • Loading branch information
pforro committed Apr 22, 2022
1 parent cd2c9a3 commit 96bb58f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
4 changes: 1 addition & 3 deletions HttpLoggerMiddleware/Messages/MessageBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ protected MessageBase(object message, IHeaderDictionary headers)
/// </summary>
private dynamic GetHeaders()
{
return _headers
.ToDictionary(h => h.Key, h => h.Value.ToString())
.ToJson();
return _headers.ToDict().ToJson();
}

/// <summary>
Expand Down
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# **HttpLoggerMiddleware**

Middleware that records all the data of the incoming requests and outgoing responses into a *.json file.
Recorded attributes: TimeStamp, Route, Method, QueryParameters, Headers, Payload.

If you find this useful, then please hit the star button on my GitHub repo
**https://github.com/pforro/HttpLoggerMiddleware.git**

## **Usage**

- Install the NuGet package
- > **https://www.nuget.org/packages/HttpLoggerMiddleware/1.0.0**
- Add the following namespace to the Program.cs file:
- > **using HttpLoggerMiddleware;**
- Add the following line to the request pipeline in the Program.cs file:
- > **app.UseHttpLogger();**
- Build and Run the web application, send some HTTP requests
- You can find the log.json file in the following path:
- > **[WorkingDirectory]/HttpLogs/log.json**
## **Author**
- Peter Cs. Forro
- Budapest, Hungary, 2022

0 comments on commit 96bb58f

Please sign in to comment.