55using JsonApiDotNetCore . Exceptions ;
66using JsonApiDotNetCore . Query ;
77using JsonApiDotNetCore . QueryParameterServices . Common ;
8+ using Microsoft . Extensions . Logging ;
89
910namespace JsonApiDotNetCore . Services
1011{
@@ -14,12 +15,15 @@ public class QueryParameterParser : IQueryParameterParser
1415 private readonly IJsonApiOptions _options ;
1516 private readonly IRequestQueryStringAccessor _queryStringAccessor ;
1617 private readonly IEnumerable < IQueryParameterService > _queryServices ;
18+ private ILogger < QueryParameterParser > _logger ;
1719
18- public QueryParameterParser ( IJsonApiOptions options , IRequestQueryStringAccessor queryStringAccessor , IEnumerable < IQueryParameterService > queryServices )
20+ public QueryParameterParser ( IJsonApiOptions options , IRequestQueryStringAccessor queryStringAccessor , IEnumerable < IQueryParameterService > queryServices , ILoggerFactory loggerFactory )
1921 {
2022 _options = options ;
2123 _queryStringAccessor = queryStringAccessor ;
2224 _queryServices = queryServices ;
25+
26+ _logger = loggerFactory . CreateLogger < QueryParameterParser > ( ) ;
2327 }
2428
2529 /// <inheritdoc/>
@@ -38,6 +42,8 @@ public virtual void Parse(DisableQueryAttribute disableQueryAttribute)
3842 var service = _queryServices . FirstOrDefault ( s => s . CanParse ( pair . Key ) ) ;
3943 if ( service != null )
4044 {
45+ _logger . LogDebug ( $ "Query string parameter '{ pair . Key } ' with value '{ pair . Value } ' was accepted by { service . GetType ( ) . Name } .") ;
46+
4147 if ( ! service . IsEnabled ( disableQueryAttribute ) )
4248 {
4349 throw new InvalidQueryStringParameterException ( pair . Key ,
@@ -46,6 +52,7 @@ public virtual void Parse(DisableQueryAttribute disableQueryAttribute)
4652 }
4753
4854 service . Parse ( pair . Key , pair . Value ) ;
55+ _logger . LogDebug ( $ "Query string parameter '{ pair . Key } ' was successfully parsed.") ;
4956 }
5057 else if ( ! _options . AllowCustomQueryStringParameters )
5158 {
0 commit comments