Browse Source

Improve logging

pull/2440/head
Halil İbrahim Kalkan 7 years ago
parent
commit
3758dbab68
  1. 15
      modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionStore.cs

15
modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionStore.cs

@ -31,32 +31,33 @@ namespace Volo.Abp.PermissionManagement
protected virtual async Task<PermissionGrantCacheItem> GetCacheItemAsync(string name, string providerName, string providerKey)
{
Logger.LogDebug($"PermissionStore.GetCacheItemAsync: name={name}, providerName={providerName}, providerKey={providerKey}");
var cacheKey = CalculateCacheKey(name, providerName, providerKey);
Logger.LogDebug($"PermissionStore.GetCacheItemAsync: {cacheKey}");
var cacheItem = await Cache.GetAsync(cacheKey);
if (cacheItem != null)
{
Logger.LogDebug("Found in the cache.");
Logger.LogDebug($"Found in the cache: {cacheKey}");
return cacheItem;
}
Logger.LogDebug("Not found in the cache, getting from the repository!");
Logger.LogDebug($"Not found in the cache, getting from the repository: {cacheKey}");
cacheItem = new PermissionGrantCacheItem(
name,
await PermissionGrantRepository.FindAsync(name, providerName, providerKey) != null
(await PermissionGrantRepository.FindAsync(name, providerName, providerKey)) != null
);
Logger.LogDebug("Setting the cache item.");
Logger.LogDebug($"Setting the cache item: {cacheKey}");
await Cache.SetAsync(
cacheKey,
cacheItem
);
Logger.LogDebug("Finished setting the cache item.");
Logger.LogDebug($"Finished setting the cache item: {cacheKey}");
return cacheItem;
}

Loading…
Cancel
Save