Added Trace Info
This commit is contained in:
parent
77f4b49d9a
commit
ed7ac5303e
2 changed files with 20 additions and 1 deletions
|
@ -5,12 +5,22 @@ using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace BirdsiteLive.Controllers
|
namespace BirdsiteLive.Controllers
|
||||||
{
|
{
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class InboxController : ControllerBase
|
public class InboxController : ControllerBase
|
||||||
{
|
{
|
||||||
|
private readonly ILogger<InboxController> _logger;
|
||||||
|
|
||||||
|
#region Ctor
|
||||||
|
public InboxController(ILogger<InboxController> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
[Route("/inbox")]
|
[Route("/inbox")]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IActionResult> Inbox()
|
public async Task<IActionResult> Inbox()
|
||||||
|
@ -19,6 +29,8 @@ namespace BirdsiteLive.Controllers
|
||||||
using (var reader = new StreamReader(Request.Body))
|
using (var reader = new StreamReader(Request.Body))
|
||||||
{
|
{
|
||||||
var body = await reader.ReadToEndAsync();
|
var body = await reader.ReadToEndAsync();
|
||||||
|
|
||||||
|
_logger.LogTrace("Inbox: {Body}", body);
|
||||||
//System.IO.File.WriteAllText($@"C:\apdebug\inbox\{Guid.NewGuid()}.json", body);
|
//System.IO.File.WriteAllText($@"C:\apdebug\inbox\{Guid.NewGuid()}.json", body);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ using BirdsiteLive.Twitter;
|
||||||
using BirdsiteLive.Twitter.Models;
|
using BirdsiteLive.Twitter.Models;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Primitives;
|
using Microsoft.Extensions.Primitives;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
@ -29,15 +30,17 @@ namespace BirdsiteLive.Controllers
|
||||||
private readonly IUserService _userService;
|
private readonly IUserService _userService;
|
||||||
private readonly IStatusService _statusService;
|
private readonly IStatusService _statusService;
|
||||||
private readonly InstanceSettings _instanceSettings;
|
private readonly InstanceSettings _instanceSettings;
|
||||||
|
private readonly ILogger<UsersController> _logger;
|
||||||
|
|
||||||
#region Ctor
|
#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;
|
_twitterUserService = twitterUserService;
|
||||||
_userService = userService;
|
_userService = userService;
|
||||||
_statusService = statusService;
|
_statusService = statusService;
|
||||||
_instanceSettings = instanceSettings;
|
_instanceSettings = instanceSettings;
|
||||||
_twitterTweetService = twitterTweetService;
|
_twitterTweetService = twitterTweetService;
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -57,6 +60,8 @@ namespace BirdsiteLive.Controllers
|
||||||
[Route("/users/{id}")]
|
[Route("/users/{id}")]
|
||||||
public IActionResult Index(string id)
|
public IActionResult Index(string id)
|
||||||
{
|
{
|
||||||
|
_logger.LogTrace("User Index: {Id}", id);
|
||||||
|
|
||||||
id = id.Trim(new[] { ' ', '@' }).ToLowerInvariant();
|
id = id.Trim(new[] { ' ', '@' }).ToLowerInvariant();
|
||||||
|
|
||||||
// Ensure valid username
|
// Ensure valid username
|
||||||
|
@ -131,6 +136,8 @@ namespace BirdsiteLive.Controllers
|
||||||
using (var reader = new StreamReader(Request.Body))
|
using (var reader = new StreamReader(Request.Body))
|
||||||
{
|
{
|
||||||
var body = await reader.ReadToEndAsync();
|
var body = await reader.ReadToEndAsync();
|
||||||
|
|
||||||
|
_logger.LogTrace("User Inbox: {Body}", body);
|
||||||
//System.IO.File.WriteAllText($@"C:\apdebug\{Guid.NewGuid()}.json", body);
|
//System.IO.File.WriteAllText($@"C:\apdebug\{Guid.NewGuid()}.json", body);
|
||||||
|
|
||||||
var activity = ApDeserializer.ProcessActivity(body);
|
var activity = ApDeserializer.ProcessActivity(body);
|
||||||
|
|
Loading…
Add table
Reference in a new issue