Add logging

This commit is contained in:
Robert McRackan 2020-09-01 09:35:13 -04:00
parent eda62975ba
commit 0beb3bf437

View File

@ -13,19 +13,33 @@ namespace InternalUtilities
{ {
/// <summary>USE THIS from within Libation. It wraps the call with correct JSONPath</summary> /// <summary>USE THIS from within Libation. It wraps the call with correct JSONPath</summary>
public static Task<Api> GetApiAsync(string username, string localeName, ILoginCallback loginCallback = null) public static Task<Api> GetApiAsync(string username, string localeName, ILoginCallback loginCallback = null)
=> EzApiCreator.GetApiAsync( {
Serilog.Log.Logger.Information("GetApiAsync. {@DebugInfo}", new
{
username,
LocaleName = localeName,
});
return EzApiCreator.GetApiAsync(
Localization.Get(localeName), Localization.Get(localeName),
AudibleApiStorage.AccountsSettingsFile, AudibleApiStorage.AccountsSettingsFile,
AudibleApiStorage.GetIdentityTokensJsonPath(username, localeName), AudibleApiStorage.GetIdentityTokensJsonPath(username, localeName),
loginCallback); loginCallback);
}
/// <summary>USE THIS from within Libation. It wraps the call with correct JSONPath</summary> /// <summary>USE THIS from within Libation. It wraps the call with correct JSONPath</summary>
public static Task<Api> GetApiAsync(ILoginCallback loginCallback, Account account) public static Task<Api> GetApiAsync(ILoginCallback loginCallback, Account account)
=> EzApiCreator.GetApiAsync( {
Serilog.Log.Logger.Information("GetApiAsync. {@DebugInfo}", new
{
AccountId = account?.AccountId ?? "[empty]",
LocaleName = account?.Locale?.Name
});
return EzApiCreator.GetApiAsync(
account.Locale, account.Locale,
AudibleApiStorage.AccountsSettingsFile, AudibleApiStorage.AccountsSettingsFile,
account.GetIdentityTokensJsonPath(), account.GetIdentityTokensJsonPath(),
loginCallback); loginCallback);
}
private static AsyncRetryPolicy policy { get; } private static AsyncRetryPolicy policy { get; }
= Policy.Handle<Exception>() = Policy.Handle<Exception>()