mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
updates to logging
This commit is contained in:
@ -43,7 +43,6 @@ namespace Bit.Core.Services
|
||||
|
||||
public async Task PushSyncCipherUpdateAsync(Cipher cipher, IEnumerable<Guid> collectionIds)
|
||||
{
|
||||
_logger.LogInformation(Constants.BypassFiltersEventId, "Relay PushSyncCipherUpdateAsync");
|
||||
await PushCipherAsync(cipher, PushType.SyncCipherUpdate, collectionIds);
|
||||
}
|
||||
|
||||
@ -73,7 +72,6 @@ namespace Bit.Core.Services
|
||||
RevisionDate = cipher.RevisionDate,
|
||||
};
|
||||
|
||||
_logger.LogInformation(Constants.BypassFiltersEventId, "Relay PushCipherAsync");
|
||||
await SendPayloadToUserAsync(cipher.UserId.Value, type, message, true);
|
||||
}
|
||||
}
|
||||
@ -143,7 +141,6 @@ namespace Bit.Core.Services
|
||||
|
||||
private async Task SendPayloadToUserAsync(Guid userId, PushType type, object payload, bool excludeCurrentContext)
|
||||
{
|
||||
_logger.LogInformation(Constants.BypassFiltersEventId, "Relay SendPayloadToUserAsync1");
|
||||
var request = new PushSendRequestModel
|
||||
{
|
||||
UserId = userId.ToString(),
|
||||
@ -151,9 +148,9 @@ namespace Bit.Core.Services
|
||||
Payload = payload
|
||||
};
|
||||
|
||||
_logger.LogInformation(Constants.BypassFiltersEventId, "Relay SendPayloadToUserAsync2");
|
||||
_logger.LogInformation(Constants.BypassFiltersEventId, "Relay SendPayloadToUserAsync 1");
|
||||
await AddCurrentContextAsync(request, excludeCurrentContext);
|
||||
_logger.LogInformation(Constants.BypassFiltersEventId, "Relay SendPayloadToUserAsync3");
|
||||
_logger.LogInformation(Constants.BypassFiltersEventId, "Relay SendPayloadToUserAsync 2");
|
||||
await SendAsync(HttpMethod.Post, "push/send", request);
|
||||
}
|
||||
|
||||
@ -172,20 +169,26 @@ namespace Bit.Core.Services
|
||||
|
||||
private async Task AddCurrentContextAsync(PushSendRequestModel request, bool addIdentifier)
|
||||
{
|
||||
_logger.LogInformation(Constants.BypassFiltersEventId, "Relay AddCurrentContextAsync 0");
|
||||
var currentContext = _httpContextAccessor?.HttpContext?.
|
||||
RequestServices.GetService(typeof(CurrentContext)) as CurrentContext;
|
||||
if(!string.IsNullOrWhiteSpace(currentContext?.DeviceIdentifier))
|
||||
{
|
||||
_logger.LogInformation(Constants.BypassFiltersEventId, "Relay AddCurrentContextAsync 1");
|
||||
var device = await _deviceRepository.GetByIdentifierAsync(currentContext.DeviceIdentifier);
|
||||
_logger.LogInformation(Constants.BypassFiltersEventId, "Relay AddCurrentContextAsync 2");
|
||||
if(device != null)
|
||||
{
|
||||
_logger.LogInformation(Constants.BypassFiltersEventId, "Relay AddCurrentContextAsync 3");
|
||||
request.DeviceId = device.Id.ToString();
|
||||
}
|
||||
if(addIdentifier)
|
||||
{
|
||||
_logger.LogInformation(Constants.BypassFiltersEventId, "Relay AddCurrentContextAsync 4");
|
||||
request.Identifier = currentContext.DeviceIdentifier;
|
||||
}
|
||||
}
|
||||
_logger.LogInformation(Constants.BypassFiltersEventId, "Relay AddCurrentContextAsync 5");
|
||||
}
|
||||
|
||||
public Task SendPayloadToUserAsync(string userId, PushType type, object payload, string identifier,
|
||||
|
Reference in New Issue
Block a user