Added Trace Info

This commit is contained in:
Nicolas Constant 2021-04-15 21:21:22 -04:00
parent 77f4b49d9a
commit ed7ac5303e
No known key found for this signature in database
GPG key ID: 1E9F677FB01A5688
2 changed files with 20 additions and 1 deletions

View file

@ -5,12 +5,22 @@ using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace BirdsiteLive.Controllers
{
[ApiController]
public class InboxController : ControllerBase
{
private readonly ILogger<InboxController> _logger;
#region Ctor
public InboxController(ILogger<InboxController> logger)
{
_logger = logger;
}
#endregion
[Route("/inbox")]
[HttpPost]
public async Task<IActionResult> Inbox()
@ -19,6 +29,8 @@ namespace BirdsiteLive.Controllers
using (var reader = new StreamReader(Request.Body))
{
var body = await reader.ReadToEndAsync();
_logger.LogTrace("Inbox: {Body}", body);
//System.IO.File.WriteAllText($@"C:\apdebug\inbox\{Guid.NewGuid()}.json", body);
}

View file

@ -17,6 +17,7 @@ using BirdsiteLive.Twitter;
using BirdsiteLive.Twitter.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
@ -29,15 +30,17 @@ namespace BirdsiteLive.Controllers
private readonly IUserService _userService;
private readonly IStatusService _statusService;
private readonly InstanceSettings _instanceSettings;
private readonly ILogger<UsersController> _logger;
#region Ctor
public UsersController(ITwitterUserService twitterUserService, IUserService userService, IStatusService statusService, InstanceSettings instanceSettings, ITwitterTweetsService twitterTweetService)
public UsersController(ITwitterUserService twitterUserService, IUserService userService, IStatusService statusService, InstanceSettings instanceSettings, ITwitterTweetsService twitterTweetService, ILogger<UsersController> logger)
{
_twitterUserService = twitterUserService;
_userService = userService;
_statusService = statusService;
_instanceSettings = instanceSettings;
_twitterTweetService = twitterTweetService;
_logger = logger;
}
#endregion
@ -57,6 +60,8 @@ namespace BirdsiteLive.Controllers
[Route("/users/{id}")]
public IActionResult Index(string id)
{
_logger.LogTrace("User Index: {Id}", id);
id = id.Trim(new[] { ' ', '@' }).ToLowerInvariant();
// Ensure valid username
@ -131,6 +136,8 @@ namespace BirdsiteLive.Controllers
using (var reader = new StreamReader(Request.Body))
{
var body = await reader.ReadToEndAsync();
_logger.LogTrace("User Inbox: {Body}", body);
//System.IO.File.WriteAllText($@"C:\apdebug\{Guid.NewGuid()}.json", body);
var activity = ApDeserializer.ProcessActivity(body);