ubeac / ubeac-api

Source of uBeac .NET Core packages
3 stars 2 forks source link

HTTP Logging - Don't log everything! #150

Open ilhesam opened 1 year ago

ilhesam commented 1 year ago

As a developer, I don't want log everything in my project. Ok, Why?

  1. The request and response of some endpoints/actions have critical data (username, password, access token, etc.).
  2. I don't need to logging some data.

I will write the available solutions below.

ilhesam commented 1 year ago

The first solution is using attribute to avoid to log critical data/properties, Like this:

public class LoginRequest
{
    [LogIgnore]
    public string UserName { get; set; }

    [LogIgnore]
    public string Password { get; set; }
}