-
-
Notifications
You must be signed in to change notification settings - Fork 150
Logging Behavior #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Logging Behavior #15
Conversation
| @@ -1,5 +1,5 @@ | |||
| { | |||
| "UseInMemoryDatabase": false, | |||
| "UseInMemoryDatabase": true, | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed
| services.AddMediatR(Assembly.GetExecutingAssembly()); | ||
| //services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>)); | ||
| services.AddTransient(typeof(IPipelineBehavior<,>), typeof(LoggingBehaviour<,>)); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionaly I'm not sure that is proper place to do it. There could be more suitable place.
For an example create method like below:
public static void AddMediatr(this IServiceCollcetion services){
services.AddMediatr(Assembly...
services.AddTransient(typeof(IPipelineBehavior....
}and use it in AddApplicationLayer method instead of line 16. (services.AddMediatr...)
| public AuthenticatedUserService(IHttpContextAccessor httpContextAccessor) | ||
| { | ||
| UserId = httpContextAccessor.HttpContext?.User?.FindFirstValue("uid"); | ||
| Username = httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.NameIdentifier); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to the logging behavior. Should be commited in separate PR.
| @@ -1,4 +1,5 @@ | |||
| using AspNetCoreHero.Boilerplate.Application.Interfaces.Repositories; | |||
| using AspNetCoreHero.Boilerplate.Application.Exceptions; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed namespace
| var requestName = typeof(TRequest).Name; | ||
| try | ||
| { | ||
| _logger.LogInformation("{Name} Request From User {UserId}-{UserName}", requestName, _authenticatedUserService.UserId, _authenticatedUserService.Username); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use _logger.LogDebug( because it can be very big amount of data.
No description provided.