<commit_before>using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
using Newtonsoft.Json;
using NLog;

namespace Thinktecture.Relay.Server.Filters
{
	public class NLogActionFilter : IActionFilter
	{
		private readonly ILogger _logger;
		private readonly JsonSerializerSettings _jsonSettings;

		/// <inheritdoc />
		public bool AllowMultiple => true;

		public NLogActionFilter(ILogger logger)
		{
			_logger = logger;

			_jsonSettings = new JsonSerializerSettings()
			{
				ReferenceLoopHandling = ReferenceLoopHandling.Ignore
			};
		}

		public async Task<HttpResponseMessage> ExecuteActionFilterAsync(HttpActionContext actionContext, CancellationToken cancellationToken, Func<Task<HttpResponseMessage>> continuation)
		{
			if (actionContext == null)
				throw new ArgumentNullException(nameof(actionContext));
			if (continuation == null)
				throw new ArgumentNullException(nameof(continuation));

			// This serializes the complete request body to the log. For the time being, prevent that:
			// _logger?.Trace("[Request] {0}: {1}. Arguments: {2}", actionContext.Request?.Method, actionContext.Request?.RequestUri, SerializeArguments(actionContext.ActionArguments));
			var response = await continuation().ConfigureAwait(false);
			_logger?.Trace("[Response] {0} - {1} ({2}): {3}", actionContext.Request?.Method, response.StatusCode, (int)response.StatusCode, actionContext.Request?.RequestUri);

			return response;
		}<commit_msg>Remove trace log of message body<commit_after>using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
using Newtonsoft.Json;
using NLog;

namespace Thinktecture.Relay.Server.Filters
{
	public class NLogActionFilter : IActionFilter
	{
		private readonly ILogger _logger;
		private readonly JsonSerializerSettings _jsonSettings;

		/// <inheritdoc />
		public bool AllowMultiple => true;

		public NLogActionFilter(ILogger logger)
		{
			_logger = logger;

			_jsonSettings = new JsonSerializerSettings()
			{
				ReferenceLoopHandling = ReferenceLoopHandling.Ignore
			};
		}

		public async Task<HttpResponseMessage> ExecuteActionFilterAsync(HttpActionContext actionContext, CancellationToken cancellationToken, Func<Task<HttpResponseMessage>> continuation)
		{
			if (actionContext == null)
				throw new ArgumentNullException(nameof(actionContext));
			if (continuation == null)
				throw new ArgumentNullException(nameof(continuation));

			var response = await continuation().ConfigureAwait(false);
			_logger?.Trace("[Response] {0} - {1} ({2}): {3}", actionContext.Request?.Method, response.StatusCode, (int)response.StatusCode, actionContext.Request?.RequestUri);

			return response;
		}
{'fraction_non_alphanumeric': 0.10206185567010309, 'fraction_numerical': 0.003780068728522337, 'mean_word_length': 5.4832962138084635, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '525859', 'n_tokens_mistral': 881, 'n_tokens_neox': 808, 'n_words': 194}