mirror of
https://github.com/bitwarden/server.git
synced 2025-01-26 22:31:30 +01:00
log domain with warnings
This commit is contained in:
parent
e7dbe6d4be
commit
6f7d07530a
@ -58,7 +58,7 @@ namespace Bit.Icons.Controllers
|
||||
var result = await _iconFetchingService.GetIconAsync(domain);
|
||||
if(result == null)
|
||||
{
|
||||
_logger.LogInformation("Null result returned.");
|
||||
_logger.LogWarning("Null result returned for {0}.", domain);
|
||||
icon = null;
|
||||
}
|
||||
else
|
||||
@ -69,7 +69,7 @@ namespace Bit.Icons.Controllers
|
||||
// Only cache not found and smaller images (<= 50kb)
|
||||
if(_iconsSettings.CacheEnabled && (icon == null || icon.Image.Length <= 50012))
|
||||
{
|
||||
_logger.LogInformation("Cache the icon.");
|
||||
_logger.LogWarning("Cache the icon for {0}.", domain);
|
||||
_memoryCache.Set(mappedDomain, icon, new MemoryCacheEntryOptions
|
||||
{
|
||||
AbsoluteExpirationRelativeToNow = new TimeSpan(_iconsSettings.CacheHours, 0, 0),
|
||||
|
@ -55,7 +55,7 @@ namespace Bit.Icons.Services
|
||||
{
|
||||
if(!Uri.TryCreate($"https://{domain}", UriKind.Absolute, out var parsedHttpsUri))
|
||||
{
|
||||
_logger.LogInformation("Bad domain.");
|
||||
_logger.LogWarning("Bad domain: {0}.", domain);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -90,7 +90,8 @@ namespace Bit.Icons.Services
|
||||
|
||||
if(response?.Content == null || !response.IsSuccessStatusCode)
|
||||
{
|
||||
_logger.LogInformation("Couldn't load a website: {0}.", response?.StatusCode.ToString() ?? "null");
|
||||
_logger.LogWarning("Couldn't load a website for {0}: {1}.", domain,
|
||||
response?.StatusCode.ToString() ?? "null");
|
||||
Cleanup(response);
|
||||
return null;
|
||||
}
|
||||
@ -103,7 +104,7 @@ namespace Bit.Icons.Services
|
||||
uri = response.RequestMessage.RequestUri;
|
||||
if(document.DocumentElement == null)
|
||||
{
|
||||
_logger.LogInformation("No DocumentElement.");
|
||||
_logger.LogWarning("No DocumentElement for {0}.", domain);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -204,7 +205,7 @@ namespace Bit.Icons.Services
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogInformation("No favicon.ico found.");
|
||||
_logger.LogWarning("No favicon.ico found for {0}.", uri.Host);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user