diff --git a/.DS_Store b/.DS_Store
deleted file mode 100644
index 44c10964..00000000
Binary files a/.DS_Store and /dev/null differ
diff --git a/.gitignore b/.gitignore
index 282c8bf1..b51546d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,9 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
+# OS-specific files
+.DS_Store
+
# User-specific files
*.suo
*.user
diff --git a/IPPDotNetDevKitCSV3/.DS_Store b/IPPDotNetDevKitCSV3/.DS_Store
deleted file mode 100644
index 945ace22..00000000
Binary files a/IPPDotNetDevKitCSV3/.DS_Store and /dev/null differ
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core.Test/LogRequestsToDiskTest.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core.Test/LogRequestsToDiskTest.cs
deleted file mode 100644
index b0f08e01..00000000
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core.Test/LogRequestsToDiskTest.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-using System.Configuration;
-using System.IO;
-using System.Linq;
-using Intuit.Ipp.Core.Rest;
-using Intuit.Ipp.Exception;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Collections.Generic;
-
-namespace Intuit.Ipp.Core.Test
-{
- ///
- ///This is a test class for LogRequestsToDiskTest and is intended
- ///to contain all LogRequestsToDiskTest Unit Tests
- ///
- [TestClass()]
- public class LogRequestsToDiskTest
- {
- private TestContext testContextInstance;
-
- ///
- ///Gets or sets the test context which provides
- ///information about and functionality for the current test run.
- ///
- public TestContext TestContext
- {
- get
- {
- return testContextInstance;
- }
- set
- {
- testContextInstance = value;
- }
- }
-
- #region Additional test attributes
- //
- //You can use the following additional attributes as you write your tests:
- //
- //Use ClassInitialize to run code before running the first test in the class
- //[ClassInitialize()]
- //public static void MyClassInitialize(TestContext testContext)
- //{
- //}
- //
- //Use ClassCleanup to run code after all tests in a class have run
- //[ClassCleanup()]
- //public static void MyClassCleanup()
- //{
- //}
- //
- //Use TestInitialize to run code before running each test
- //[TestInitialize()]
- //public void MyTestInitialize()
- //{
- //}
- //
- //Use TestCleanup to run code after each test has run
- //[TestCleanup()]
- //public void MyTestCleanup()
- //{
- //}
- //
- #endregion
-
- /////
- /////A test for LogPlatformRequests
- /////
- //[TestMethod()]
- //public void LogPlatformRequestsTest()
- //{
- // string folderPath = Path.GetTempPath();
- // string strReqLogFiles = string.Format(CoreConstants.REQUESTFILENAME_FORMAT, folderPath, CoreConstants.SLASH_CHAR, "*");
- // string strResLogFiles = string.Format(CoreConstants.RESPONSEFILENAME_FORMAT, folderPath, CoreConstants.SLASH_CHAR, "*");
- // var allFiles = Directory.EnumerateFiles(folderPath, Path.GetFileName(strReqLogFiles)).ToList();
- // allFiles.AddRange(Directory.EnumerateFiles(folderPath, Path.GetFileName(strResLogFiles)));
- // allFiles.ForEach(file => File.Delete(file));
-
- // string xml = "Invalid security token";
- // LogRequestsToDisk_Accessor requestLogging = new LogRequestsToDisk_Accessor();
- // requestLogging.EnableServiceRequestsLogging = true;
- // requestLogging.ServiceRequestLoggingLocation = folderPath;
- // requestLogging.LogPlatformRequests(xml, true);
- // requestLogging.LogPlatformRequests(xml, false);
- // DirectoryInfo info = new DirectoryInfo(folderPath);
-
- // try
- // {
- // allFiles = Directory.EnumerateFiles(folderPath, Path.GetFileName(strReqLogFiles)).ToList();
- // allFiles.AddRange(Directory.EnumerateFiles(folderPath, Path.GetFileName(strResLogFiles)));
-
- // Assert.AreEqual(2, allFiles.Count);
- // }
- // catch (System.Exception ex)
- // {
- // Assert.Fail(ex.ToString());
- // }
- //}
-
- }
-}
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/AppSettings.json b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/AppSettings.json
index 70cac442..f04275fb 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/AppSettings.json
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/AppSettings.json
@@ -1,9 +1,5 @@
{
"Logger": {
- "RequestLog": {
- "EnableLogs": "false",
- "LogDirectory": ""
- }
},
//not supported -added for backward compatibility
"CustomLogger": {
@@ -13,32 +9,6 @@
"Type": ""
}
},
- "SeriLogger": {
- "RequestSerilog": {
- "Debug": {
- "EnableLogs": "true"
- },
- "Trace": {
- "EnableLogs": "true"
- },
- "Console:": {
- "Enable": "true"
- },
- "File": {
- "Enable": "true",
- "LogDirectory": ""
- },
- "AzureDocumentDB": {
- "Enable": "true",
- "Url": "",
- "SecureKey": "",
- "TimeToLive": ""
- }
-
-
-
- }
- },
"Security": {
"Mode": {
"Oauth": {
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/AdvancedLogger.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/AdvancedLogger.cs
index 7e8aff7c..914bc216 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/AdvancedLogger.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/AdvancedLogger.cs
@@ -29,12 +29,9 @@ namespace Intuit.Ipp.Core.Configuration
public class AdvancedLogger
{
///
- /// Gets or sets the Request logging mechanism.
+ /// Gets or sets the .
///
- public RequestAdvancedLog RequestAdvancedLog { get; set; }
-
-
-
+ public IAdvancedLogger Logger { get; set; }
}
}
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/IppConfiguration.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/IppConfiguration.cs
index db5b76c8..916fc171 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/IppConfiguration.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/IppConfiguration.cs
@@ -33,7 +33,7 @@ namespace Intuit.Ipp.Core.Configuration
public class IppConfiguration
{
///
- /// Gets or sets the Serilog Logger mechanism.
+ /// Gets or sets the Advanced Logger mechanism.
///
public AdvancedLogger AdvancedLogger { get; set; }
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/JsonFileConfigurationProvider.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/JsonFileConfigurationProvider.cs
index f958adf5..1f0d6806 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/JsonFileConfigurationProvider.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/JsonFileConfigurationProvider.cs
@@ -91,20 +91,11 @@ public IppConfiguration GetConfiguration()
IppConfiguration ippConfig = new IppConfiguration();
#if !NETSTANDARD2_0
- //initializing the Advanced Serilogger
IppConfigurationSection ippConfigurationSection = IppConfigurationSection.Instance;
ippConfig.AdvancedLogger = new AdvancedLogger
{
-
- RequestAdvancedLog = new RequestAdvancedLog()
- {
- EnableSerilogRequestResponseLoggingForDebug = false,
- EnableSerilogRequestResponseLoggingForTrace = false,
- EnableSerilogRequestResponseLoggingForConsole = false,
- EnableSerilogRequestResponseLoggingForFile = false,
- ServiceRequestLoggingLocationForFile = System.IO.Path.GetTempPath()
- }
+ Logger = new TraceLogger(),
};
if (ippConfigurationSection == null)
@@ -115,11 +106,6 @@ public IppConfiguration GetConfiguration()
ippConfig.Logger = new Logger
{
CustomLogger = new TraceLogger(),
- RequestLog = new RequestLog
- {
- EnableRequestResponseLogging = false,
- ServiceRequestLoggingLocation = System.IO.Path.GetTempPath()
- }
};
ippConfig.Message = new Message
@@ -160,23 +146,6 @@ public IppConfiguration GetConfiguration()
}
ippConfig.Logger = new Logger();
- ippConfig.Logger.RequestLog = new RequestLog();
- ippConfig.Logger.RequestLog.EnableRequestResponseLogging = ippConfigurationSection.Logger.RequestLog.EnableRequestResponseLogging;
- if (string.IsNullOrEmpty(ippConfigurationSection.Logger.RequestLog.RequestResponseLoggingDirectory))
- {
- ippConfig.Logger.RequestLog.ServiceRequestLoggingLocation = Path.GetTempPath();
- }
- else
- {
- string location = ippConfigurationSection.Logger.RequestLog.RequestResponseLoggingDirectory;
- if (!Directory.Exists(location))
- {
- IdsException exception = new IdsException(Properties.Resources.ValidDirectoryPathMessage, new DirectoryNotFoundException());
- IdsExceptionManager.HandleException(exception);
- }
-
- ippConfig.Logger.RequestLog.ServiceRequestLoggingLocation = ippConfigurationSection.Logger.RequestLog.RequestResponseLoggingDirectory;
- }
if (!string.IsNullOrEmpty(ippConfigurationSection.Logger.CustomLogger.Name) && !string.IsNullOrEmpty(ippConfigurationSection.Logger.CustomLogger.Type) && ippConfigurationSection.Logger.CustomLogger.Enable)
{
@@ -355,26 +324,13 @@ public IppConfiguration GetConfiguration()
ippConfig.AdvancedLogger = new AdvancedLogger
{
-
- RequestAdvancedLog = new RequestAdvancedLog()
- {
- EnableSerilogRequestResponseLoggingForDebug = false,
- EnableSerilogRequestResponseLoggingForTrace = false,
- EnableSerilogRequestResponseLoggingForConsole = false,
- EnableSerilogRequestResponseLoggingForFile = false,
- ServiceRequestLoggingLocationForFile = System.IO.Path.GetTempPath()
- }
+ Logger = new TraceLogger(),
};
ippConfig.Logger = new Logger
{
CustomLogger = new TraceLogger(),
- RequestLog = new RequestLog
- {
- EnableRequestResponseLogging = false,
- ServiceRequestLoggingLocation = System.IO.Path.GetTempPath()
- }
};
ippConfig.Message = new Message
@@ -417,7 +373,6 @@ public IppConfiguration GetConfiguration()
//Read all appsettings.json sections
- var loggerSettings = builder.GetSection("Logger").GetSection("RequestLog");
var customLoggerSettings = builder.GetSection("CustomLogger").GetSection("RequestLog");
var securitySettings = builder.GetSection("Security").GetSection("Mode");
var securityOauthSettings = builder.GetSection("Security").GetSection("Mode").GetSection("OAuth");
@@ -432,91 +387,6 @@ public IppConfiguration GetConfiguration()
var serviceBaseUrlSettings = builder.GetSection("Service").GetSection("BaseUrl");
var serviceMinorversionSettings = builder.GetSection("Service").GetSection("Minorversion");
var webhooksVerifierTokenSettings = builder.GetSection("WebhooksService").GetSection("VerifierToken");
- var serilogLoggerSettings = builder.GetSection("SeriLogger").GetSection("RequestSerilog");
- var serilogLoggerSettingsDebug = builder.GetSection("SeriLogger").GetSection("RequestSerilog").GetSection("Debug");
- var serilogLoggerSettingsConsole = builder.GetSection("SeriLogger").GetSection("RequestSerilog").GetSection("Console");
- var serilogLoggerSettingsFile = builder.GetSection("SeriLogger").GetSection("RequestSerilog").GetSection("File");
-
-
-
- #region support later
-
- //if (!string.IsNullOrEmpty(serilogLoggerSettingsAzureDocumentDB["LogDirectory"]) && Convert.ToBoolean(serilogLoggerSettingsAzureDocumentDB["EnableLogs"]) == true)
- //{
-
-
- // ippConfig.AdvancedLogger.RequestAdvancedLog.EnableSerilogRequestResponseLoggingForAzureDocumentDB = Convert.ToBoolean(serilogLoggerSettingsAzureDocumentDB["EnableLogs"]);
-
-
- // string url = serilogLoggerSettingsAzureDocumentDB["Url"];
- // Uri parsedUrl = new Uri(url);
- // string secureKey = serilogLoggerSettingsAzureDocumentDB["SecureKey"];
-
- // if (string.IsNullOrEmpty(url))
- // {
- // IdsException exception = new IdsException(Properties.Resources.AzureDocumentDBSecureKeyNullEmptyMessage, new ArgumentNullException());
- // IdsExceptionManager.HandleException(exception);
- // }
- // if (string.IsNullOrEmpty(secureKey))
- // {
- // IdsException exception = new IdsException(Properties.Resources.AzureDocumentDBSecureKeyNullEmptyMessage, new ArgumentNullException());
- // IdsExceptionManager.HandleException(exception);
- // }
-
-
- // if (string.IsNullOrEmpty(serilogLoggerSettingsAzureDocumentDB["TimeToLive"]))
- // {
- // ippConfig.AdvancedLogger.RequestAdvancedLog.ServiceRequestAzureDocumentDBTTL = 7;//Defaulted to last 7 days logs
- // }
- // else
- // {
- // ippConfig.AdvancedLogger.RequestAdvancedLog.ServiceRequestAzureDocumentDBTTL = Convert.ToInt32(serilogLoggerSettingsAzureDocumentDB["TimeToLive"]);
- // }
-
- // ippConfig.AdvancedLogger.RequestAdvancedLog.ServiceRequestAzureDocumentDBUrl = parsedUrl;
- // ippConfig.AdvancedLogger.RequestAdvancedLog.ServiceRequestAzureDocumentDBSecureKey = secureKey;
-
-
- //}
-
- #endregion
-
- if (!string.IsNullOrEmpty(serilogLoggerSettingsFile["LogDirectory"]) && Convert.ToBoolean(serilogLoggerSettingsFile["EnableLogs"]) == true)
- {
-
-
-
- ippConfig.AdvancedLogger.RequestAdvancedLog.EnableSerilogRequestResponseLoggingForFile = Convert.ToBoolean(serilogLoggerSettingsFile["EnableLogs"]);
-
-
- string location = loggerSettings["LogDirectory"];
- if (!Directory.Exists(location))
- {
- IdsException exception = new IdsException(Properties.Resources.ValidDirectoryPathMessage, new DirectoryNotFoundException());
- IdsExceptionManager.HandleException(exception);
- }
-
- ippConfig.AdvancedLogger.RequestAdvancedLog.ServiceRequestLoggingLocationForFile = serilogLoggerSettingsFile["LogDirectory"];
-
- }
-
- //old logger
- if (!string.IsNullOrEmpty(loggerSettings["LogDirectory"]) && Convert.ToBoolean(loggerSettings["EnableLogs"]) == true)
- {
-
- ippConfig.Logger.RequestLog.EnableRequestResponseLogging = Convert.ToBoolean(loggerSettings["EnableLogs"]);
-
-
- string location = loggerSettings["LogDirectory"];
- if (!Directory.Exists(location))
- {
- IdsException exception = new IdsException(Properties.Resources.ValidDirectoryPathMessage, new DirectoryNotFoundException());
- IdsExceptionManager.HandleException(exception);
- }
-
- ippConfig.Logger.RequestLog.ServiceRequestLoggingLocation = loggerSettings["LogDirectory"];
-
- }
if (!string.IsNullOrEmpty(customLoggerSettings["Name"]) && !string.IsNullOrEmpty(customLoggerSettings["Type"]) && Convert.ToBoolean(customLoggerSettings["Enable"]) == true)
{
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/Logger.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/Logger.cs
index 69d2e5ae..00d1387f 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/Logger.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/Logger.cs
@@ -28,11 +28,6 @@ namespace Intuit.Ipp.Core.Configuration
///
public class Logger
{
- ///
- /// Gets or sets the Request logging mechanism.
- ///
- public RequestLog RequestLog { get; set; }
-
///
/// Gets or sets the Custom logger implementation class.
///
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/MemoryConfigurationProvider.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/MemoryConfigurationProvider.cs
index ab921893..684cc81b 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/MemoryConfigurationProvider.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/MemoryConfigurationProvider.cs
@@ -44,11 +44,6 @@ public MemoryConfigurationProvider(IppConfiguration cfg)
cfg.Logger = new Logger
{
CustomLogger = new TraceLogger(),
- RequestLog = new RequestLog
- {
- EnableRequestResponseLogging = false,
- ServiceRequestLoggingLocation = System.IO.Path.GetTempPath()
- }
};
}
@@ -56,15 +51,7 @@ public MemoryConfigurationProvider(IppConfiguration cfg)
{
cfg.AdvancedLogger = new AdvancedLogger
{
-
- RequestAdvancedLog = new RequestAdvancedLog()
- {
- EnableSerilogRequestResponseLoggingForDebug = false,
- EnableSerilogRequestResponseLoggingForTrace = false,
- EnableSerilogRequestResponseLoggingForConsole = false,
- EnableSerilogRequestResponseLoggingForFile = false,
- ServiceRequestLoggingLocationForFile = System.IO.Path.GetTempPath()
- }
+ Logger = new TraceLogger(),
};
}
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/RequestAdvancedLog.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/RequestAdvancedLog.cs
deleted file mode 100644
index dfdd7da3..00000000
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/RequestAdvancedLog.cs
+++ /dev/null
@@ -1,150 +0,0 @@
-// -----------------------------------------------------------------------
-//
-/*******************************************************************************
- * Copyright 2016 Intuit
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *******************************************************************************/
-// This file contains SdkException.
-// This file contains Request Log configuration.
-// -----------------------------------------------------------------------
-
-using System;
-
-namespace Intuit.Ipp.Core.Configuration
-{
- using System.IO;
- using Intuit.Ipp.Exception;
- using Serilog;
-
- ///
- /// Contains properties used to indicate whether request and response messages are to be logged.
- ///
- public class RequestAdvancedLog
- {
- ///
- /// request logging location.
- ///
- private string serviceRequestLoggingLocationForFile;
-
-
- ///
- /// Gets or sets a value indicating whether to enable reqeust response logging for Debug logs.
- ///
- public bool EnableSerilogRequestResponseLoggingForDebug { get; set; }
-
-
- ///
- /// Gets or sets a value indicating whether to enable reqeust response logging for Trace logs.
- ///
- public bool EnableSerilogRequestResponseLoggingForTrace { get; set; }
-
-
- ///
- /// Gets or sets a value indicating whether to enable reqeust response logging for Console logs.
- ///
- public bool EnableSerilogRequestResponseLoggingForConsole { get; set; }
-
-
- ///
- /// Gets or sets a value indicating whether to enable reqeust response logging for logs.
- ///
- public bool EnableSerilogRequestResponseLoggingForFile { get; set; }
-
-
- ///
- /// Gets or sets the service request logging location for File, Rolling File.
- ///
- public string ServiceRequestLoggingLocationForFile
- {
- get
- {
- return this.serviceRequestLoggingLocationForFile;
- }
-
- set
- {
- if (!Directory.Exists(value))
- {
- IdsException exception = new IdsException(Properties.Resources.ValidDirectoryPathMessage, new DirectoryNotFoundException());
- IdsExceptionManager.HandleException(exception);
- }
-
- this.serviceRequestLoggingLocationForFile= value;
- }
- }
-
- ///
- /// Serilog CustomLogger
- ///
- public Serilog.ILogger CustomLogger { get; set; }
-
-
-
- #region support later
- /////
- ///// Gets or sets the service request logging location for File, Rolling File.
- /////
- //public Uri ServiceRequestAzureDocumentDBUrl
- //{
- // get
- // {
- // return this.serviceRequestAzureDocumentDBUrl;
- // }
-
- // set
- // {
- // if (EnableSerilogRequestResponseLoggingForAzureDocumentDB == true)
- // {
- // if (value == null)
- // {
- // IdsException exception = new IdsException(Properties.Resources.AzureDocumentDBUrlNullEmptyMessage, new ArgumentNullException());
- // IdsExceptionManager.HandleException(exception);
- // }
- // }
-
- // this.serviceRequestAzureDocumentDBUrl = value;
-
- // }
- //}
-
- /////
- ///// Gets or sets the service request logging location for File, Rolling File.
- /////
- //public string ServiceRequestAzureDocumentDBSecureKey
- //{
- // get
- // {
- // return this.serviceRequestAzureDocumentDBSecureKey;
- // }
-
- // set
- // {
- // if (EnableSerilogRequestResponseLoggingForAzureDocumentDB == true)
- // {
- // if (value == null || value == "")
- // {
- // IdsException exception = new IdsException(Properties.Resources.AzureDocumentDBSecureKeyNullEmptyMessage, new ArgumentNullException());
- // IdsExceptionManager.HandleException(exception);
- // }
- // }
-
- // this.serviceRequestAzureDocumentDBSecureKey = value;
- // }
- //}
- #endregion
-
-
-
- }
-}
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/RequestLog.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/RequestLog.cs
deleted file mode 100644
index 2722092d..00000000
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Configuration/RequestLog.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-// -----------------------------------------------------------------------
-//
-/*******************************************************************************
- * Copyright 2016 Intuit
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *******************************************************************************/
-// This file contains SdkException.
-// This file contains Request Log configuration.
-// -----------------------------------------------------------------------
-
-using System;
-
-namespace Intuit.Ipp.Core.Configuration
-{
- using System.IO;
- using Intuit.Ipp.Exception;
-
- ///
- /// Contains properties used to indicate whether request and response messages are to be logged.
- ///
- public class RequestLog
- {
- ///
- /// request logging location.
- ///
- private string serviceRequestLoggingLocation;
-
- ///
- /// Gets or sets a value indicating whether to enable reqeust response logging.
- ///
- [Obsolete("EnableRequestResponsLogging is deprecated, please use EnableRequestResponseLogging instead.", true)]
- public bool EnableRequestResponsLogging { get; set; }
-
- ///
- /// Gets or sets a value indicating whether to enable reqeust response logging.
- ///
- public bool EnableRequestResponseLogging { get; set; }
-
- ///
- /// Gets or sets the service request logging location.
- ///
- public string ServiceRequestLoggingLocation
- {
- get
- {
- return this.serviceRequestLoggingLocation;
- }
-
- set
- {
- if (!Directory.Exists(value))
- {
- IdsException exception = new IdsException(Properties.Resources.ValidDirectoryPathMessage, new DirectoryNotFoundException());
- IdsExceptionManager.HandleException(exception);
- }
-
- this.serviceRequestLoggingLocation = value;
- }
- }
- }
-}
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/CoreHelper.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/CoreHelper.cs
index 84a03e41..22705339 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/CoreHelper.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/CoreHelper.cs
@@ -39,9 +39,9 @@ public static class CoreHelper
///
- /// Gets or sets Serilog Request Logging.
+ /// Gets or sets Advanced Request Logger.
///
- internal static Diagnostics.AdvancedLogging AdvancedLogging;
+ internal static Diagnostics.IAdvancedLogger AdvancedLogging;
///
/// Gets the serializer mechanism using the service context and the depending on the request and response.
@@ -154,64 +154,19 @@ public static ICompressor GetCompressor(ServiceContext serviceContext, bool isRe
}
///
- /// Gets the Request Response Logging mechanism.
+ /// Gets the Request Response Logging mechanism for advanced logging.
///
/// The serivce context object.
/// Returns value which specifies the request response logging mechanism.
- public static Rest.LogRequestsToDisk GetRequestLogging(ServiceContext serviceContext)
+ public static Diagnostics.IAdvancedLogger GetAdvancedLogging(ServiceContext serviceContext)
{
- Rest.LogRequestsToDisk requestLogger;
- if (serviceContext.IppConfiguration != null &&
- serviceContext.IppConfiguration.Logger != null &&
- serviceContext.IppConfiguration.Logger.RequestLog != null)
+ var requestLogger = serviceContext.IppConfiguration?.AdvancedLogger?.Logger;
+ if (requestLogger != null)
{
- requestLogger = new Rest.LogRequestsToDisk(
- serviceContext.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging,
- serviceContext.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation);
- }
- else
- {
- requestLogger = new Rest.LogRequestsToDisk(false, null);
- }
-
- return requestLogger;
- }
-
-
- ///
- /// Gets the Request Response Logging mechanism for advanced logging using serilog.
- ///
- /// The serivce context object.
- /// Returns value which specifies the request response logging mechanism.
- public static Diagnostics.AdvancedLogging GetAdvancedLogging(ServiceContext serviceContext)
- {
- Diagnostics.AdvancedLogging requestLogger;
- if (serviceContext.IppConfiguration != null &&
- serviceContext.IppConfiguration.AdvancedLogger != null &&
- serviceContext.IppConfiguration.AdvancedLogger.RequestAdvancedLog != null)
- {
- if (serviceContext.IppConfiguration.AdvancedLogger.RequestAdvancedLog.CustomLogger != null)
- {
- //Use custom logger
- requestLogger = new Diagnostics.AdvancedLogging(serviceContext.IppConfiguration.AdvancedLogger.RequestAdvancedLog.CustomLogger);
- }
- else
- {
- requestLogger = new Diagnostics.AdvancedLogging(
- serviceContext.IppConfiguration.AdvancedLogger.RequestAdvancedLog.EnableSerilogRequestResponseLoggingForDebug,
- serviceContext.IppConfiguration.AdvancedLogger.RequestAdvancedLog.EnableSerilogRequestResponseLoggingForTrace,
- serviceContext.IppConfiguration.AdvancedLogger.RequestAdvancedLog.EnableSerilogRequestResponseLoggingForConsole,
- serviceContext.IppConfiguration.AdvancedLogger.RequestAdvancedLog.EnableSerilogRequestResponseLoggingForFile,
- serviceContext.IppConfiguration.AdvancedLogger.RequestAdvancedLog.ServiceRequestLoggingLocationForFile);
-
- }
- }
- else
- {
- requestLogger = new Diagnostics.AdvancedLogging(enableSerilogRequestResponseLoggingForDebug: true, enableSerilogRequestResponseLoggingForTrace: true, enableSerilogRequestResponseLoggingForConsole: true, enableSerilogRequestResponseLoggingForFile: false, serviceRequestLoggingLocationForFile: null);
+ return requestLogger;
}
- return requestLogger;
+ return new Diagnostics.TraceLogger();
}
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/GlobalSuppression.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/GlobalSuppression.cs
index 9b576d7b..5c07f4dc 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/GlobalSuppression.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/GlobalSuppression.cs
@@ -141,7 +141,6 @@
[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "Intuit.Ipp.Core.ServiceContext.#IppConfiguration", MessageId = "Ipp")]
[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "Intuit.Ipp.Core.ServiceContext.#Create(System.String,System.String,Intuit.Ipp.Core.IntuitServicesType,System.String)", MessageId = "Dbid")]
[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "namespace", Target = "Intuit.Ipp.Core.Configuration", MessageId = "Ipp")]
-[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "Intuit.Ipp.Core.Configuration.RequestLog.#EnableRequestResponsLogging", MessageId = "Respons")]
[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "Intuit.Ipp.Core.Configuration.BaseUrl.#Ips", MessageId = "Ips")]
[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "Intuit.Ipp.Core.Configuration.BaseUrl.#Qbo", MessageId = "Qbo")]
[module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "Intuit.Ipp.Core.Configuration.BaseUrl.#Qbd", MessageId = "Qbd")]
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Intuit.Ipp.Core.csproj b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Intuit.Ipp.Core.csproj
index 6cc92a20..a8fbd862 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Intuit.Ipp.Core.csproj
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Intuit.Ipp.Core.csproj
@@ -11,7 +11,6 @@
-
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/LogRequestsToDisk.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/LogRequestsToDisk.cs
deleted file mode 100644
index eb826b71..00000000
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/LogRequestsToDisk.cs
+++ /dev/null
@@ -1,123 +0,0 @@
-////********************************************************************
-//
-/*******************************************************************************
- * Copyright 2016 Intuit
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *******************************************************************************/
-// This file contains SdkException.
-// This file contains logic for Logging API Requests/Responses To Disk
-////********************************************************************
-
-namespace Intuit.Ipp.Core.Rest
-{
- using System;
- using System.Globalization;
- using System.IO;
- using System.Text;
- //using Intuit.Ipp.Core;
- using Intuit.Ipp.Exception;
- using Intuit.Ipp.Utility;
-
- ///
- /// Logs API Requests/Responses To Disk
- ///
- public class LogRequestsToDisk
- {
- ///
- /// Initializes a new instance of the class.
- ///
- public LogRequestsToDisk()
- : this(false, null)
- {
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Value indicating whether to log request response messages.
- /// Request Response logging locationl
- public LogRequestsToDisk(bool enableServiceRequestLogging, string serviceRequestLoggingLocation)
- {
- this.EnableServiceRequestsLogging = enableServiceRequestLogging;
- this.ServiceRequestLoggingLocation = serviceRequestLoggingLocation;
- }
-
- ///
- /// Gets a value indicating whether Service Requests Logging should be enabled.
- ///
- internal bool EnableServiceRequestsLogging { get; private set; }
-
- ///
- /// Gets the Service Request Logging Location.
- ///
- internal string ServiceRequestLoggingLocation { get; private set; }
-
- ///
- /// Logs the Platform Request to Disk.
- ///
- /// The xml to log.
- /// Specifies whether the xml is request or response.
- public void LogPlatformRequests(string xml, bool isRequest)
- {
- if (this.EnableServiceRequestsLogging)
- {
- if (string.IsNullOrWhiteSpace(this.ServiceRequestLoggingLocation))
- {
- this.ServiceRequestLoggingLocation = Path.GetTempPath();
- }
-
- string filePath = string.Empty;
- if (this.ServiceRequestLoggingLocation.Contains("\\"))
- {
- if (isRequest)
- {
- filePath = string.Format(CultureInfo.InvariantCulture, Utility.CoreConstants.REQUESTFILENAME_FORMAT, this.ServiceRequestLoggingLocation, Utility.CoreConstants.SLASH_CHAR, DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture));
- }
- else
- {
- filePath = string.Format(CultureInfo.InvariantCulture, Utility.CoreConstants.RESPONSEFILENAME_FORMAT, this.ServiceRequestLoggingLocation, Utility.CoreConstants.SLASH_CHAR, DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture));
- }
- }
- else
- {
- if (isRequest)
- {
- filePath = Path.Combine(this.ServiceRequestLoggingLocation,"Request-" + DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture) + ".txt");
-
- }
- else
- {
- filePath = Path.Combine(this.ServiceRequestLoggingLocation, "Response-" + DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture) + ".txt");
- }
-
- }
-
- try
- {
- Encoding encoder = Encoding.GetEncoding("utf-8", new EncoderExceptionFallback(), new DecoderExceptionFallback());
- byte[] data = encoder.GetBytes(xml);
- using (FileStream fs = new FileStream(filePath, FileMode.Append, FileAccess.Write, FileShare.ReadWrite))
- {
- fs.Write(data, 0, data.Length);
- }
- }
- catch (System.Exception exception)
- {
- IdsException idsException = new IdsException("Exception has been generated. Check inner exception for details.", exception);
- IdsExceptionManager.HandleException(idsException);
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/RestCalls/AsyncRestHandler.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/RestCalls/AsyncRestHandler.cs
index 14e2a439..59dabce4 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/RestCalls/AsyncRestHandler.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/RestCalls/AsyncRestHandler.cs
@@ -210,7 +210,6 @@ private void ExecAsyncRequestWithRetryPolicy(HttpWebRequest asyncRequest)
// Invoke the end method of the asynchronous call.
HttpWebRequest request = (HttpWebRequest)ar.AsyncState;
- //enabling header logging in Serilogger
WebHeaderCollection allHeaders = request.Headers;
CoreHelper.AdvancedLogging.Log(" RequestUrl: " + request.RequestUri);
@@ -221,9 +220,6 @@ private void ExecAsyncRequestWithRetryPolicy(HttpWebRequest asyncRequest)
CoreHelper.AdvancedLogging.Log(allHeaders.GetKey(i) + "-" + allHeaders[i]);
}
- // Log Request Body to a file
- this.RequestLogging.LogPlatformRequests(" RequestUrl: " + request.RequestUri + ", Request Payload: " + this.requestBody, true);
- // Log Request Body to Serilog
CoreHelper.AdvancedLogging.Log(" Request Payload: " + this.requestBody);
@@ -448,9 +444,7 @@ private AsyncCallCompletedEventArgs CreateEventArgsForRequest(IAsyncResult async
response_intuit_tid_header = response.Headers[i];
}
}
- // Log the response to Disk.
- this.RequestLogging.LogPlatformRequests(" Response Intuit_Tid header: " + response_intuit_tid_header + ", Response Payload: " + resultString, false);
- // Log response to Serilog
+
CoreHelper.AdvancedLogging.Log(" Response Intuit_Tid header: " + response_intuit_tid_header + ", Response Payload: " + resultString);
//log response to logs
@@ -577,9 +571,6 @@ private void GetRequestStreamCallback(IAsyncResult asynchronousResult)
{
HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;
- // Log Request Body to a file
- this.RequestLogging.LogPlatformRequests(" RequestUrl: " + request.RequestUri + ", Request Payload: " + this.requestBody, true);
- // Log Request Body to Serilog
CoreHelper.AdvancedLogging.Log(" RequestUrl: " + request.RequestUri + ", Request Payload: " + this.requestBody);
UTF8Encoding encoding = new UTF8Encoding();
byte[] content = encoding.GetBytes(this.requestBody);
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/RestCalls/FaultHandler.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/RestCalls/FaultHandler.cs
index cb331fc2..e0dac0b3 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/RestCalls/FaultHandler.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/RestCalls/FaultHandler.cs
@@ -129,10 +129,7 @@ internal IdsException ParseResponseAndThrowException(WebException webException,
response_intuit_tid_header = errorResponse.Headers[i];
}
}
- //Log errorstring to disk
- CoreHelper.GetRequestLogging(this.context).LogPlatformRequests(" Response Intuit_Tid header: " + response_intuit_tid_header + ", Response Payload: " + errorString, false);
- //Log errorstring to Serilog
CoreHelper.AdvancedLogging.Log(" Response Intuit_Tid header: " + response_intuit_tid_header + ", Response Payload: " + errorString);
if (isIps)
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/RestCalls/RestHandler.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/RestCalls/RestHandler.cs
index db89f0dc..e74d2e58 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/RestCalls/RestHandler.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/RestCalls/RestHandler.cs
@@ -62,7 +62,7 @@ protected RestHandler(ServiceContext context)
this.ResponseCompressor = CoreHelper.GetCompressor(this.serviceContext, false);
this.RequestSerializer = CoreHelper.GetSerializer(this.serviceContext, true);
this.responseSerializer = CoreHelper.GetSerializer(this.serviceContext, false);
- this.RequestLogging = CoreHelper.GetRequestLogging(this.serviceContext);
+
// this.AdvancedLogging = CoreHelper.GetAdvancedLogging(this.serviceContext);
}
@@ -94,16 +94,6 @@ protected RestHandler()
///
internal IEntitySerializer RequestSerializer { get; set; }
- ///
- /// Gets or sets Request Logging.
- ///
- internal LogRequestsToDisk RequestLogging { get; set; }
-
- /////
- ///// Gets or sets Serilog Request Logging.
- /////
- //internal static AdvancedLogging AdvancedLogging { get; set; }
-
///
/// Gets or sets the minorVersion.
///
@@ -253,7 +243,6 @@ public virtual System.Net.HttpWebRequest PrepareRequest(RequestParameters reques
}
- //enabling header logging in Serilogger
WebHeaderCollection allHeaders = httpWebRequest.Headers;
CoreHelper.AdvancedLogging.Log(" RequestUrl: " + httpWebRequest.RequestUri);
@@ -264,10 +253,6 @@ public virtual System.Net.HttpWebRequest PrepareRequest(RequestParameters reques
CoreHelper.AdvancedLogging.Log(allHeaders.GetKey(i) + "-" + allHeaders[i]);
}
-
- // Log Request Body to a file
- this.RequestLogging.LogPlatformRequests(" RequestUrl: " + requestEndpoint + ", Request Payload:" + requestXML.ToString(), true);
- //Log to Serilog
CoreHelper.AdvancedLogging.Log( "Request Payload:" + requestXML.ToString());
// Use of encoding to get bytes used to write to request stream.
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/RestCalls/SyncRestHandler.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/RestCalls/SyncRestHandler.cs
index bde53b05..e57d4720 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/RestCalls/SyncRestHandler.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/RestCalls/SyncRestHandler.cs
@@ -379,8 +379,7 @@ private string ParseResponse(HttpWebResponse httpWebResponse)
response_intuit_tid_header = httpWebResponse.Headers[i];
}
}
- this.RequestLogging.LogPlatformRequests(" Response Intuit_Tid header: " + response_intuit_tid_header + ", Response Payload: " + response, false);
- //Log to Serilog
+
CoreHelper.AdvancedLogging.Log(" Response Intuit_Tid header: " + response_intuit_tid_header + ", Response Payload: " + response);
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Retry/IntuitRetryPolicy.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Retry/IntuitRetryPolicy.cs
index bdae3570..5a400dab 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Retry/IntuitRetryPolicy.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Core/Retry/IntuitRetryPolicy.cs
@@ -409,10 +409,6 @@ public void ExecuteAction(Action beginAction, Func(Func func)
}
}
- // Log the error string to disk.
- CoreHelper.GetRequestLogging(this.context).LogPlatformRequests(" Response Intuit_Tid header: " + response_intuit_tid_header + " Response Payload: " + errorString, false);
- //Log to Serilog
CoreHelper.AdvancedLogging.Log("Response Intuit_Tid header: " + response_intuit_tid_header + ", Response Payload: " + errorString);
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Diagnostics/AdvancedLogging.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Diagnostics/AdvancedLogging.cs
deleted file mode 100644
index f60bff37..00000000
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Diagnostics/AdvancedLogging.cs
+++ /dev/null
@@ -1,272 +0,0 @@
-// -----------------------------------------------------------------------
-//
-/*******************************************************************************
- * Copyright 2016 Intuit
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *******************************************************************************/
-// This file contains advanced logger for IPP .Net SDK..
-// -----------------------------------------------------------------------
-
-using System;
-
-namespace Intuit.Ipp.Diagnostics
-{
- using System.IO;
- //using Intuit.Ipp.Exception;
- using System;
- using Serilog;
- using Serilog.Sinks;
- using Serilog.Core;
- using Serilog.Events;
- using System.Globalization;
-
- ///
- /// Contains properties used to indicate whether request and response messages are to be logged.
- ///
- public class AdvancedLogging : IAdvancedLogger
- {
- ///
- /// request logging location.
- ///
- private string serviceRequestLoggingLocationForFile;
-
- ///
- /// request Azure Document DB url.
- ///
- private Uri serviceRequestAzureDocumentDBUrl;
-
- ///
- /// request Azure Document DB Secure Key
- ///
- private string serviceRequestAzureDocumentDBSecureKey;
-
- ///
- /// request TTL-time to live for all logs
- ///
- public double ServiceRequestAzureDocumentDBTTL { get; set; }
-
- ///
- /// Gets or sets a value indicating whether to enable reqeust response logging for Debug logs.
- ///
- public bool EnableSerilogRequestResponseLoggingForDebug { get; set; }
-
-
- ///
- /// Gets or sets a value indicating whether to enable reqeust response logging for Trace logs.
- ///
- public bool EnableSerilogRequestResponseLoggingForTrace { get; set; }
-
-
- ///
- /// Gets or sets a value indicating whether to enable reqeust response logging for Console logs.
- ///
- public bool EnableSerilogRequestResponseLoggingForConsole { get; set; }
-
-
- /////
- ///// Gets or sets a value indicating whether to enable reqeust response logging for Rolling logs.
- /////
- public bool EnableSerilogRequestResponseLoggingForFile { get; set; }
-
-
- ///
- /// Gets or sets a value indicating whether to enable reqeust response logging for Azure Doc DB logs.
- ///
- public bool EnableSerilogRequestResponseLoggingForAzureDocumentDB { get; set; }
-
-
- ///
- /// Serilog ILogger
- ///
- private Serilog.ILogger logger;
-
-
- ///
- /// Gets or sets the service request logging location for File, Rolling File.
- ///
- public string ServiceRequestLoggingLocationForFile
- {
- get
- {
- return this.serviceRequestLoggingLocationForFile;
- }
-
- set
- {
- if (!Directory.Exists(value))
- {
- this.serviceRequestLoggingLocationForFile = System.IO.Path.GetTempPath();
- }
-
- this.serviceRequestLoggingLocationForFile = value;
- }
- }
-
- #region support later
- /////
- ///// Gets or sets the service request logging location for File, Rolling File.
- /////
- //public Uri ServiceRequestAzureDocumentDBUrl
- //{
- // get
- // {
- // return this.serviceRequestAzureDocumentDBUrl;
- // }
-
- // set
- // {
- // if (EnableSerilogRequestResponseLoggingForAzureDocumentDB == true)
- // {
- // if (value == null)
- // {
- // IdsException exception = new IdsException(Properties.Resources.AzureDocumentDBUrlNullEmptyMessage, new ArgumentNullException());
- // IdsExceptionManager.HandleException(exception);
- // }
- // }
-
- // this.serviceRequestAzureDocumentDBUrl = value;
-
- // }
- //}
-
- /////
- ///// Gets or sets the service request logging location for File, Rolling File.
- /////
- //public string ServiceRequestAzureDocumentDBSecureKey
- //{
- // get
- // {
- // return this.serviceRequestAzureDocumentDBSecureKey;
- // }
-
- // set
- // {
- // if (EnableSerilogRequestResponseLoggingForAzureDocumentDB == true)
- // {
- // if (value == null && value == "")
- // {
- // IdsException exception = new IdsException(Properties.Resources.AzureDocumentDBSecureKeyNullEmptyMessage, new ArgumentNullException());
- // IdsExceptionManager.HandleException(exception);
- // }
- // }
-
- // this.serviceRequestAzureDocumentDBSecureKey = value;
- // }
- //}
-
- #endregion
-
-
- ///
- /// Initializes a new instance of Advanced logging class
- ///
- public AdvancedLogging()
- : this(enableSerilogRequestResponseLoggingForDebug: true, enableSerilogRequestResponseLoggingForTrace: true, enableSerilogRequestResponseLoggingForConsole: true, enableSerilogRequestResponseLoggingForFile: false, serviceRequestLoggingLocationForFile: null)
- {
-
- }
-
- ///
- /// Initializes a new instance of Advanced logging class
- ///
- ///
- public AdvancedLogging(Serilog.ILogger customLogger)
- {
- this.logger = customLogger;
- //Logging first info
- logger.Information("Custom Logger is initialized");
- }
-
- ///
- /// Initializes a new instance of Advanced logging class
- ///
- ///
- ///
- ///
- ///
- ///
- public AdvancedLogging(bool enableSerilogRequestResponseLoggingForDebug, bool enableSerilogRequestResponseLoggingForTrace, bool enableSerilogRequestResponseLoggingForConsole, bool enableSerilogRequestResponseLoggingForFile, string serviceRequestLoggingLocationForFile)
- {
-
- this.EnableSerilogRequestResponseLoggingForDebug = enableSerilogRequestResponseLoggingForDebug;
- this.EnableSerilogRequestResponseLoggingForTrace = enableSerilogRequestResponseLoggingForTrace;
- this.EnableSerilogRequestResponseLoggingForConsole = enableSerilogRequestResponseLoggingForConsole;
- this.EnableSerilogRequestResponseLoggingForFile = enableSerilogRequestResponseLoggingForFile;
- this.ServiceRequestLoggingLocationForFile = serviceRequestLoggingLocationForFile;
-
- string filePath = string.Empty;
-
- //Assign tempath if no location found
- if (string.IsNullOrWhiteSpace(this.ServiceRequestLoggingLocationForFile))
- {
- this.ServiceRequestLoggingLocationForFile = Path.GetTempPath();
- }
-
-
- //Log file path for widows n ios
- filePath = Path.Combine(this.ServiceRequestLoggingLocationForFile, "QBOApiLogs-" + DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture) + ".txt");
-
-
- //Setting logger config for Serilog
- var loggerConfig = new LoggerConfiguration()
- .MinimumLevel.Verbose();
-
-
- //Enabling console log
- if (this.EnableSerilogRequestResponseLoggingForConsole == true)
- {
- loggerConfig = loggerConfig.WriteTo.Console();
-
- }
-
- //Enabling Trace log
- if (this.EnableSerilogRequestResponseLoggingForTrace == true)
- {
- loggerConfig = loggerConfig.WriteTo.Trace();
- }
-
- //Enabling Debug log
- if (this.EnableSerilogRequestResponseLoggingForDebug == true)
- {
- loggerConfig = loggerConfig.WriteTo.Debug();
-
- }
-
- //Enabling file log
- if (!string.IsNullOrEmpty(this.ServiceRequestLoggingLocationForFile) && this.EnableSerilogRequestResponseLoggingForFile == true)
- {
- loggerConfig = loggerConfig.WriteTo.File(filePath);
- }
-
-
- //Creating the Logger for Serilog
- logger = loggerConfig.CreateLogger();
-
-
-
- //Logging first info
- logger.Information("Logger is initialized");
-
- }
-
- ///
- /// Logging message from SDK
- ///
- ///
- public void Log(string messageToWrite)
- {
- logger.Write(LogEventLevel.Verbose, messageToWrite);
- }
- }
-}
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Diagnostics/Interface/IAdvancedLogger.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Diagnostics/Interface/IAdvancedLogger.cs
index bbf52c5b..3772c73a 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Diagnostics/Interface/IAdvancedLogger.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Diagnostics/Interface/IAdvancedLogger.cs
@@ -31,4 +31,23 @@ public interface IAdvancedLogger
/// The message to write.
void Log(string messageToWrite);
}
+
+ ///
+ /// Null logger.
+ ///
+ public class NullAdvancedLogger : IAdvancedLogger
+ {
+ ///
+ /// Singleton instance of .
+ ///
+ public static readonly IAdvancedLogger Instance = new NullAdvancedLogger();
+
+ private NullAdvancedLogger()
+ {
+ }
+
+ void IAdvancedLogger.Log(string messageToWrite)
+ {
+ }
+ }
}
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Diagnostics/Interface/ILogger.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Diagnostics/Interface/ILogger.cs
index c7aa4ac4..666a82df 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Diagnostics/Interface/ILogger.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Diagnostics/Interface/ILogger.cs
@@ -33,4 +33,23 @@ public interface ILogger
/// The message to write.
void Log(TraceLevel idsTraceLevel, string messageToWrite);
}
+
+ ///
+ /// Null logger.
+ ///
+ public class NullLogger : ILogger
+ {
+ ///
+ /// Singleton instance of .
+ ///
+ public static readonly ILogger Instance = new NullLogger();
+
+ private NullLogger()
+ {
+ }
+
+ void ILogger.Log(TraceLevel idsTraceLevel, string messageToWrite)
+ {
+ }
+ }
}
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Diagnostics/Intuit.Ipp.Diagnostics.csproj b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Diagnostics/Intuit.Ipp.Diagnostics.csproj
index 57215bd9..1a76868f 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Diagnostics/Intuit.Ipp.Diagnostics.csproj
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Diagnostics/Intuit.Ipp.Diagnostics.csproj
@@ -3,27 +3,8 @@
netstandard2.0;net472;net461
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Diagnostics/TraceLogger.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Diagnostics/TraceLogger.cs
index a4663c65..602c79ea 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Diagnostics/TraceLogger.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Diagnostics/TraceLogger.cs
@@ -29,7 +29,7 @@ namespace Intuit.Ipp.Diagnostics
///
/// Logs trace messages using System.Diagnostics.
///
- public class TraceLogger : ILogger
+ public class TraceLogger : ILogger, IAdvancedLogger
{
///
/// Provides a multilevel switch to control tracing.
@@ -85,5 +85,10 @@ public void Log(TraceLevel idsTraceLevel, string messageToWrite)
break;
}
}
+
+ void IAdvancedLogger.Log(string messageToWrite)
+ {
+ Log(TraceLevel.Verbose, messageToWrite);
+ }
}
}
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.GlobalTaxServiceTest/GlobalTaxServiceTest.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.GlobalTaxServiceTest/GlobalTaxServiceTest.cs
index 3db9ef9c..d0e55672 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.GlobalTaxServiceTest/GlobalTaxServiceTest.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.GlobalTaxServiceTest/GlobalTaxServiceTest.cs
@@ -48,9 +48,6 @@ public TestContext TestContext
public static void MyClassInitialize(TestContext testContext)
{
context = Initializer.InitializeServiceContextQbo();
- context.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true;
- context.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"c:\\Logs";
-
}
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Nupkg/Intuit.Ipp.Nupkg.csproj b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Nupkg/Intuit.Ipp.Nupkg.csproj
index 52cb9652..7831121f 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Nupkg/Intuit.Ipp.Nupkg.csproj
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Nupkg/Intuit.Ipp.Nupkg.csproj
@@ -86,17 +86,6 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -107,18 +96,7 @@
-
-
-
-
-
-
-
-
-
-
-
@@ -127,15 +105,6 @@
-
-
-
-
-
-
-
-
-
@@ -145,7 +114,6 @@
-
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient.Diagnostics/IOAuthAdvancedLogger.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient.Diagnostics/IOAuthAdvancedLogger.cs
deleted file mode 100644
index cdaff466..00000000
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient.Diagnostics/IOAuthAdvancedLogger.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-////*********************************************************
-//
-/*******************************************************************************
- * Copyright 2016 Intuit
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *******************************************************************************/
-// This file contains an interface for Logging.
-////*********************************************************
-
-namespace Intuit.Ipp.OAuth2PlatformClient.Diagnostics
-{
- public interface IOAuthAdvancedLogger
- {
- ///
- /// Logs messages
- ///
- /// The message to write.
- void Log(string messageToWrite);
-
- }
-}
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient.Diagnostics/IOAuthLogger.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient.Diagnostics/IOAuthLogger.cs
new file mode 100644
index 00000000..afd95d7b
--- /dev/null
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient.Diagnostics/IOAuthLogger.cs
@@ -0,0 +1,112 @@
+////*********************************************************
+//
+/*******************************************************************************
+ * Copyright 2016 Intuit
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *******************************************************************************/
+// This file contains an interface for Logging.
+////*********************************************************
+
+using System.Diagnostics;
+using System.Net.Http;
+
+namespace Intuit.Ipp.OAuth2PlatformClient.Diagnostics
+{
+ ///
+ /// Logger for OAuth requests and responses.
+ ///
+ public interface IOAuthLogger
+ {
+ ///
+ /// Log a simple message.
+ ///
+ /// The message.
+ void Log(string message);
+
+ ///
+ /// Log HTTP request path and headers.
+ ///
+ /// The that will send the request, which might specify .
+ /// The .
+ void LogRequest(HttpClient httpClient, HttpRequestMessage request);
+
+ ///
+ /// Determines if the request body should be read and logged.
+ ///
+ /// if the body should be logged.
+ bool ShouldLogRequestBody();
+
+ ///
+ /// Log HTTP request body.
+ ///
+ /// The request body.
+ void LogRequestBody(string body);
+
+ ///
+ /// Log HTTP response.
+ ///
+ /// The HTTP response.
+ /// The intuit_tid header value.
+ /// A log message.
+ /// The response body.
+ void LogResponse(HttpResponseMessage response, string intuit_tid = null, string message = null, string body = null);
+
+ ///
+ /// Log HTTP response error.
+ ///
+ /// The HTTP response.
+ /// Details about the error.
+ void LogResponseError(HttpResponseMessage response, string errorDetail = null);
+ }
+
+ ///
+ /// Null logger.
+ ///
+ public class NullOAuthLogger : IOAuthLogger
+ {
+ ///
+ /// Singleton instance of .
+ ///
+ public static readonly IOAuthLogger Instance = new NullOAuthLogger();
+
+ private NullOAuthLogger()
+ {
+ }
+
+ void IOAuthLogger.Log(string messageToWrite)
+ {
+ }
+
+ void IOAuthLogger.LogRequest(HttpClient httpClient, HttpRequestMessage request)
+ {
+ }
+
+ bool IOAuthLogger.ShouldLogRequestBody()
+ {
+ return false;
+ }
+
+ void IOAuthLogger.LogRequestBody(string body)
+ {
+ }
+
+ void IOAuthLogger.LogResponse(HttpResponseMessage response, string intuit_tid, string message, string body)
+ {
+ }
+
+ void IOAuthLogger.LogResponseError(HttpResponseMessage response, string errorDetail)
+ {
+ }
+ }
+}
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient.Diagnostics/Intuit.Ipp.OAuth2PlatformClient.Diagnostics.csproj b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient.Diagnostics/Intuit.Ipp.OAuth2PlatformClient.Diagnostics.csproj
index e7936fab..dbdcea46 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient.Diagnostics/Intuit.Ipp.OAuth2PlatformClient.Diagnostics.csproj
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient.Diagnostics/Intuit.Ipp.OAuth2PlatformClient.Diagnostics.csproj
@@ -3,20 +3,5 @@
netstandard2.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient.Diagnostics/LogHelper.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient.Diagnostics/LogHelper.cs
deleted file mode 100644
index 7feaa7e1..00000000
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient.Diagnostics/LogHelper.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-////*********************************************************
-//
-/*******************************************************************************
- * Copyright 2016 Intuit
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *******************************************************************************/
-// This file contains helper for Logging.
-////*********************************************************
-///
-namespace Intuit.Ipp.OAuth2PlatformClient.Diagnostics
-{
- ///
- /// Helper class for advanced logger/serilogger
- ///
- public static class LogHelper
- {
- ///
- /// Gets the Request Response Logging mechanism for advanced logging using serilog.
- ///
- /// Returns value which specifies the request response logging mechanism.
- public static OAuthAdvancedLogging GetAdvancedLoggingCustom(Serilog.ILogger customLogger)
- {
- OAuthAdvancedLogging advancedLogger;
- advancedLogger = new OAuthAdvancedLogging(customLogger);
-
- return advancedLogger;
-
- }
-
- ///
- /// Gets the Request Response Logging mechanism for advanced logging using serilog.
- ///
- /// Returns value which specifies the request response logging mechanism.
- public static OAuthAdvancedLogging GetAdvancedLogging(bool enableSerilogRequestResponseLoggingForDebug,bool enableSerilogRequestResponseLoggingForTrace, bool enableSerilogRequestResponseLoggingForConsole,bool enableSerilogRequestResponseLoggingForFile, string serviceRequestLoggingLocationForFile)
- {
- OAuthAdvancedLogging advancedLogger;
- advancedLogger = new OAuthAdvancedLogging(enableSerilogRequestResponseLoggingForDebug: enableSerilogRequestResponseLoggingForDebug, enableSerilogRequestResponseLoggingForTrace: enableSerilogRequestResponseLoggingForTrace, enableSerilogRequestResponseLoggingForConsole: enableSerilogRequestResponseLoggingForConsole, enableSerilogRequestResponseLoggingForFile: enableSerilogRequestResponseLoggingForFile, serviceRequestLoggingLocationForFile: serviceRequestLoggingLocationForFile);
-
- return advancedLogger;
-
- }
- }
-}
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient.Diagnostics/OAuthAdvancedLogging.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient.Diagnostics/OAuthAdvancedLogging.cs
deleted file mode 100644
index 76b0f69c..00000000
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient.Diagnostics/OAuthAdvancedLogging.cs
+++ /dev/null
@@ -1,249 +0,0 @@
-////*********************************************************
-//
-/*******************************************************************************
- * Copyright 2016 Intuit
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *******************************************************************************/
-// This file contains advanced logger for IPP .Net OAuth2 SDK.
-////*********************************************************
-
-namespace Intuit.Ipp.OAuth2PlatformClient.Diagnostics
-{
- using System.IO;
- using System;
- using Serilog;
- using Serilog.Sinks.File;
- using Serilog.Core;
- using Serilog.Events;
- using System.Globalization;
-
- ///
- /// Contains properties used to indicate whether request and response messages are to be logged.
- ///
- public class OAuthAdvancedLogging : IOAuthAdvancedLogger
- {
- ///
- /// request logging location.
- ///
- private string serviceRequestLoggingLocationForFile;
-
- ///
- /// Gets or sets a value indicating whether to enable reqeust response logging for Debug logs.
- ///
- public bool EnableSerilogRequestResponseLoggingForDebug { get; set; }
-
-
- ///
- /// Gets or sets a value indicating whether to enable reqeust response logging for Trace logs.
- ///
- public bool EnableSerilogRequestResponseLoggingForTrace { get; set; }
-
-
- ///
- /// Gets or sets a value indicating whether to enable reqeust response logging for Console logs.
- ///
- public bool EnableSerilogRequestResponseLoggingForConsole { get; set; }
-
-
- ///
- /// Gets or sets a value indicating whether to enable reqeust response logging for File logs.
- ///
- public bool EnableSerilogRequestResponseLoggingForFile { get; set; }
-
-
- ///
- /// Gets or sets the service request logging location for File, Rolling File.
- ///
- public string ServiceRequestLoggingLocationForFile
- {
- get
- {
- return this.serviceRequestLoggingLocationForFile;
- }
-
- set
- {
- if (!Directory.Exists(value))
- {
- this.serviceRequestLoggingLocationForFile = System.IO.Path.GetTempPath();
- }
-
- this.serviceRequestLoggingLocationForFile = value;
- }
- }
-
-
- ///
- /// Serilog Logger
- ///
- private Serilog.ILogger logger;
-
- #region support later
- /////
- ///// Gets or sets the service request logging location for File, Rolling File.
- /////
- //public Uri ServiceRequestAzureDocumentDBUrl
- //{
- // get
- // {
- // return this.serviceRequestAzureDocumentDBUrl;
- // }
-
- // set
- // {
- // if (EnableSerilogRequestResponseLoggingForAzureDocumentDB == true)
- // {
- // if (value == null)
- // {
- // IdsException exception = new IdsException(Properties.Resources.AzureDocumentDBUrlNullEmptyMessage, new ArgumentNullException());
- // IdsExceptionManager.HandleException(exception);
- // }
- // }
-
- // this.serviceRequestAzureDocumentDBUrl = value;
-
- // }
- //}
-
- /////
- ///// Gets or sets the service request logging location for File, Rolling File.
- /////
- //public string ServiceRequestAzureDocumentDBSecureKey
- //{
- // get
- // {
- // return this.serviceRequestAzureDocumentDBSecureKey;
- // }
-
- // set
- // {
- // if (EnableSerilogRequestResponseLoggingForAzureDocumentDB == true)
- // {
- // if (value == null && value == "")
- // {
- // IdsException exception = new IdsException(Properties.Resources.AzureDocumentDBSecureKeyNullEmptyMessage, new ArgumentNullException());
- // IdsExceptionManager.HandleException(exception);
- // }
- // }
-
- // this.serviceRequestAzureDocumentDBSecureKey = value;
- // }
- //}
-
- #endregion
-
-
- ///
- /// Initializes a new instance of AdvanceLogging
- ///
- public OAuthAdvancedLogging()
- : this(enableSerilogRequestResponseLoggingForDebug: true, enableSerilogRequestResponseLoggingForTrace: true, enableSerilogRequestResponseLoggingForConsole: true, enableSerilogRequestResponseLoggingForFile: false, serviceRequestLoggingLocationForFile: null)
- {
- }
-
- ///
- /// Initializes a new instance of Advanced logging class
- ///
- ///
- public OAuthAdvancedLogging(Serilog.ILogger customLogger)
- {
- this.logger = customLogger;
- //Logging first info
- logger.Information("Custom Logger is initialized");
- }
-
-
- ///
- /// Initializes a new instance of Advanced logger
- ///
- ///
- ///
- ///
- ///
- ///
- public OAuthAdvancedLogging(bool enableSerilogRequestResponseLoggingForDebug, bool enableSerilogRequestResponseLoggingForTrace, bool enableSerilogRequestResponseLoggingForConsole, bool enableSerilogRequestResponseLoggingForFile, string serviceRequestLoggingLocationForFile)
- {
- this.EnableSerilogRequestResponseLoggingForDebug = enableSerilogRequestResponseLoggingForDebug;
- this.EnableSerilogRequestResponseLoggingForTrace = enableSerilogRequestResponseLoggingForTrace;
- this.EnableSerilogRequestResponseLoggingForConsole = enableSerilogRequestResponseLoggingForConsole;
- this.EnableSerilogRequestResponseLoggingForFile = enableSerilogRequestResponseLoggingForFile;
- this.ServiceRequestLoggingLocationForFile = serviceRequestLoggingLocationForFile;
-
-
-
-
- string filePath = string.Empty;
-
- if (this.EnableSerilogRequestResponseLoggingForFile)
- {
- //Assign tempath if no location found
- if (string.IsNullOrWhiteSpace(this.ServiceRequestLoggingLocationForFile))
- {
- this.ServiceRequestLoggingLocationForFile = Path.GetTempPath();
- }
-
-
- //Log file path for widows n ios
- filePath = Path.Combine(this.ServiceRequestLoggingLocationForFile, "QBOApiLogs-" + DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture) + ".txt");
-
- }
-
- //Setting logger config for Serilog
- var loggerConfig = new LoggerConfiguration()
- .MinimumLevel.Verbose();
-
-
- //Enabling console log
- if (this.EnableSerilogRequestResponseLoggingForConsole == true)
- {
- loggerConfig = loggerConfig.WriteTo.Console();
- }
-
- //Enabling Trace log
- if (this.EnableSerilogRequestResponseLoggingForTrace == true)
- {
- loggerConfig = loggerConfig.WriteTo.Trace();
- }
-
- //Enabling Debug log
- if (this.EnableSerilogRequestResponseLoggingForDebug == true)
- {
- loggerConfig = loggerConfig.WriteTo.Debug();
-
- }
-
- //Enabling file log
- if (!string.IsNullOrEmpty(this.ServiceRequestLoggingLocationForFile) && this.EnableSerilogRequestResponseLoggingForFile == true)
- {
- loggerConfig = loggerConfig.WriteTo.File(filePath);
- }
-
- //Creating the Logger for Serilog
- logger = loggerConfig.CreateLogger();
-
- //Logging first info
- logger.Information("Logger is initialized");
-
- }
-
- ///
- /// Logging message from SDK
- ///
- ///
- public void Log(string messageToWrite)
- {
- logger.Write(LogEventLevel.Verbose, messageToWrite);
- }
- }
-}
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/OAuth2Client.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/OAuth2Client.cs
index c0b2a71a..63120b2c 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/OAuth2Client.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/OAuth2Client.cs
@@ -6,20 +6,12 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
-using System.Net.Http;
-using System.Net.Http.Headers;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Net;
-using System.Reflection;
-using System.Linq;
-using System.IO;
-using System.Globalization;
-using Serilog;
using Intuit.Ipp.OAuth2PlatformClient.Diagnostics;
-using Serilog;
namespace Intuit.Ipp.OAuth2PlatformClient
{ ///
@@ -27,96 +19,6 @@ namespace Intuit.Ipp.OAuth2PlatformClient
///
public class OAuth2Client
{
- ///
- /// Advanced Logger for OAuth2 calls
- ///
- public static OAuthAdvancedLogging AdvancedLogger;
-
- ///
- /// Enable extra field to check if new OAuth2Client is used for OAuth calls and Advanced logging
- ///
- internal static bool AdvancedLoggerEnabled = false;
-
- ///
- /// Internal field to check if OAuth2Client is used for OAuth calls to enable on intuit-tid based logs, no verbose logs will be enabled if this is true
- ///
- internal static bool ShowInfoLogs = false;
-
- ///
- /// Enable extra field to check if OAuth2Client is used for OAuth calls to enable on intuit-tid based logs, no verbose logs will be enabled if this is true
- ///
- public bool EnableAdvancedLoggerInfoMode { get; set; } = false;
-
-
-
- ///
- /// request logging location.
- ///
- private string serviceRequestLoggingLocationForFile;
-
- ///
- /// request Azure Document DB url.
- ///
- private Uri serviceRequestAzureDocumentDBUrl;
-
- ///
- /// request Azure Document DB Secure Key
- ///
- private string serviceRequestAzureDocumentDBSecureKey;
-
- /////
- ///// request TTL-time to live for all logs
- /////
- //public double ServiceRequestAzureDocumentDBTTL { get; set; }
-
- ///
- /// Gets or sets a value indicating whether to enable reqeust response logging for Debug logs.
- ///
- public bool EnableSerilogRequestResponseLoggingForDebug { get; set; }
-
-
- ///
- /// Gets or sets a value indicating whether to enable reqeust response logging for Trace logs.
- ///
- public bool EnableSerilogRequestResponseLoggingForTrace { get; set; }
-
-
- ///
- /// Gets or sets a value indicating whether to enable reqeust response logging for Console logs.
- ///
- public bool EnableSerilogRequestResponseLoggingForConsole { get; set; }
-
-
- /////
- ///// Gets or sets a value indicating whether to enable reqeust response logging for file logs.
- /////
- public bool EnableSerilogRequestResponseLoggingForFile { get; set; }
-
-
- ///
- /// Gets or sets the service request logging location for File.
- ///
- public string ServiceRequestLoggingLocationForFile
- {
- get
- {
- return this.serviceRequestLoggingLocationForFile;
- }
-
- set
- {
- if (!Directory.Exists(value))
- {
- this.serviceRequestLoggingLocationForFile = System.IO.Path.GetTempPath();
- }
-
-
- this.serviceRequestLoggingLocationForFile = value;
-
- }
- }
-
-
///
/// ClientId
///
@@ -151,12 +53,18 @@ public string ServiceRequestLoggingLocationForFile
/// DiscoveryUrl
///
public string DiscoveryUrl { get; set; }
-
+
+ private IOAuthLogger logger;
+
///
- /// CustomLogger
+ /// Logger for OAuth requests and responses.
+ /// Defaults to .
///
- public Serilog.ILogger CustomLogger { get; set; }
-
+ public IOAuthLogger Logger
+ {
+ get => logger ?? NullOAuthLogger.Instance;
+ set => logger = value;
+ }
///
/// OAuth2Client constructor
@@ -194,44 +102,6 @@ public OAuth2Client(string clientID, string clientSecret, string redirectURI, st
}
-
- /////
- ///// OAuth2Client constructor
- /////
- /////
- /////
- /////
- ///// This can either be sandbox, production or an actual discovery url
- //public OAuth2Client(string clientID, string clientSecret, string redirectURI, string environment, ILogger customLogger)
- //{
- // this.CustomLogger = customLogger ?? throw new ArgumentNullException(nameof(customLogger));
- // ClientID = clientID ?? throw new ArgumentNullException(nameof(clientID));
- // ClientSecret = clientSecret ?? throw new ArgumentNullException(nameof(clientSecret));
- // RedirectURI = redirectURI ?? throw new ArgumentNullException(nameof(redirectURI));
- // if (environment != null && environment != "")
- // {
- // try
- // {
- // ApplicationEnvironment = (AppEnvironment)Enum.Parse(typeof(AppEnvironment), environment, true);
- // }
- // catch (System.Exception ex)
- // {
- // ApplicationEnvironment = AppEnvironment.Custom;
- // DiscoveryUrl = environment;
- // }
-
-
- // }
-
-
-
- // DiscoveryDoc = GetDiscoveryDoc();
-
-
- //}
-
-
-
///
/// Gets Discovery Doc
///
@@ -270,26 +140,7 @@ public string GetAuthorizationURL(List scopes, string CSRFToken)
{
throw new System.Exception("Discovery Call failed. Authorize Endpoint is empty.");
}
- AdvancedLoggerEnabled = true;
- //Set internal property to track only informational -intuit_tid based logs
- if (EnableAdvancedLoggerInfoMode == true)
- {
- ShowInfoLogs = true;
- }
-
- if (this.CustomLogger != null)
- {
- //Use custom logger
- AdvancedLogger = LogHelper.GetAdvancedLoggingCustom(this.CustomLogger);
-
- }
- else
- {
- //Intialize Logger
- AdvancedLogger = LogHelper.GetAdvancedLogging(enableSerilogRequestResponseLoggingForDebug: this.EnableSerilogRequestResponseLoggingForDebug, enableSerilogRequestResponseLoggingForTrace: this.EnableSerilogRequestResponseLoggingForTrace, enableSerilogRequestResponseLoggingForConsole: this.EnableSerilogRequestResponseLoggingForConsole, enableSerilogRequestResponseLoggingForFile: this.EnableSerilogRequestResponseLoggingForFile, serviceRequestLoggingLocationForFile: this.ServiceRequestLoggingLocationForFile);
-
- }
string scopeValue = "";
for (var index = 0; index < scopes.Count; index++)
{
@@ -307,7 +158,7 @@ public string GetAuthorizationURL(List scopes, string CSRFToken)
CSRFToken);
//Logging authorization request
- AdvancedLogger.Log("Logging AuthorizationRequest:" + authorizationRequest);
+ Logger.Log("Logging AuthorizationRequest:" + authorizationRequest);
return authorizationRequest;
}
@@ -325,25 +176,6 @@ public string GetAuthorizationURL(List scopes, string CSRFToken)
{
throw new System.Exception("Discovery Call failed. Authorize Endpoint is empty.");
}
- AdvancedLoggerEnabled = true;
- //Set internal property to track only informational -intuit_tid based logs
- if (EnableAdvancedLoggerInfoMode == true)
- {
- ShowInfoLogs = true;
- }
-
- if (this.CustomLogger != null)
- {
- //Use custom logger
- AdvancedLogger = LogHelper.GetAdvancedLoggingCustom(this.CustomLogger);
-
-
- }
- else
- {
- //Intialize Logger
- AdvancedLogger = LogHelper.GetAdvancedLogging(enableSerilogRequestResponseLoggingForDebug: this.EnableSerilogRequestResponseLoggingForDebug, enableSerilogRequestResponseLoggingForTrace: this.EnableSerilogRequestResponseLoggingForTrace, enableSerilogRequestResponseLoggingForConsole: this.EnableSerilogRequestResponseLoggingForConsole, enableSerilogRequestResponseLoggingForFile: this.EnableSerilogRequestResponseLoggingForFile, serviceRequestLoggingLocationForFile: this.ServiceRequestLoggingLocationForFile);
- }
string scopeValue = "";
for (var index = 0; index < scopes.Count; index++)
@@ -362,7 +194,7 @@ public string GetAuthorizationURL(List scopes, string CSRFToken)
CSRFToken);
//Logging authorization request
- AdvancedLogger.Log("Logging AuthorizationRequest:" + authorizationRequest);
+ Logger.Log("Logging AuthorizationRequest:" + authorizationRequest);
return authorizationRequest;
}
@@ -379,28 +211,6 @@ public string GetAuthorizationURL(List scopes)
throw new System.Exception("Discovery Call failed. Authorize Endpoint is empty.");
}
- AdvancedLoggerEnabled = true;
- //Set internal property to track only informational -intuit_tid based logs
- if (EnableAdvancedLoggerInfoMode == true)
- {
- ShowInfoLogs = true;
- }
-
- if (this.CustomLogger != null)
- {
- //Use custom logger
- AdvancedLogger = LogHelper.GetAdvancedLoggingCustom(this.CustomLogger);
-
-
- }
- else
- {
- //Intialize Logger
- AdvancedLogger = LogHelper.GetAdvancedLogging(enableSerilogRequestResponseLoggingForDebug: this.EnableSerilogRequestResponseLoggingForDebug, enableSerilogRequestResponseLoggingForTrace: this.EnableSerilogRequestResponseLoggingForTrace, enableSerilogRequestResponseLoggingForConsole: this.EnableSerilogRequestResponseLoggingForConsole, enableSerilogRequestResponseLoggingForFile: this.EnableSerilogRequestResponseLoggingForFile, serviceRequestLoggingLocationForFile: this.ServiceRequestLoggingLocationForFile);
- }
-
-
-
string scopeValue = "";
for (var index = 0; index < scopes.Count; index++)
{
@@ -420,7 +230,7 @@ public string GetAuthorizationURL(List scopes)
CSRFToken);
//Logging authorization request
- AdvancedLogger.Log("Logging AuthorizationRequest:" + authorizationRequest);
+ Logger.Log("Logging AuthorizationRequest:" + authorizationRequest);
return authorizationRequest;
}
@@ -553,30 +363,10 @@ public string GetAuthorizationURL(List scopes)
{
if (string.IsNullOrEmpty(DiscoveryDoc.TokenEndpoint))
{
- AdvancedLogger.Log("Discovery Call failed.BearerToken Endpoint is empty.");
+ Logger.Log("Discovery Call failed.BearerToken Endpoint is empty.");
return new TokenResponse(HttpStatusCode.InternalServerError, "Discovery Call failed. BearerToken Endpoint is empty.");
}
- AdvancedLoggerEnabled = true;
- //Set internal property to track only informational -intuit_tid based logs
- if (EnableAdvancedLoggerInfoMode == true)
- {
- ShowInfoLogs = true;
- }
- if (this.CustomLogger != null)
- {
- //Use custom logger
- AdvancedLogger = LogHelper.GetAdvancedLoggingCustom(this.CustomLogger);
-
-
- }
- else
- {
- //Intialize Logger
- AdvancedLogger = LogHelper.GetAdvancedLogging(enableSerilogRequestResponseLoggingForDebug: this.EnableSerilogRequestResponseLoggingForDebug, enableSerilogRequestResponseLoggingForTrace: this.EnableSerilogRequestResponseLoggingForTrace, enableSerilogRequestResponseLoggingForConsole: this.EnableSerilogRequestResponseLoggingForConsole, enableSerilogRequestResponseLoggingForFile: this.EnableSerilogRequestResponseLoggingForFile, serviceRequestLoggingLocationForFile: this.ServiceRequestLoggingLocationForFile);
-
- }
-
var tokenClient = new TokenClient(DiscoveryDoc.TokenEndpoint, ClientID, ClientSecret);
return await tokenClient.RequestTokenFromCodeAsync(code, RedirectURI, cancellationToken: cancellationToken).ConfigureAwait(false);
}
@@ -593,31 +383,10 @@ public string GetAuthorizationURL(List scopes)
{
if (string.IsNullOrEmpty(tokenEndpoint))
{
- AdvancedLogger.Log("BearerToken Endpoint is empty.");
+ Logger.Log("BearerToken Endpoint is empty.");
return new TokenResponse(HttpStatusCode.InternalServerError, "BearerToken Endpoint is empty.");
}
- AdvancedLoggerEnabled = true;
- //Set internal property to track only informational -intuit_tid based logs
- if (EnableAdvancedLoggerInfoMode == true)
- {
- ShowInfoLogs = true;
- }
-
- if (this.CustomLogger != null)
- {
- //Use custom logger
- AdvancedLogger = LogHelper.GetAdvancedLoggingCustom(this.CustomLogger);
-
-
- }
- else
- {
- //Intialize Logger
- AdvancedLogger = LogHelper.GetAdvancedLogging(enableSerilogRequestResponseLoggingForDebug: this.EnableSerilogRequestResponseLoggingForDebug, enableSerilogRequestResponseLoggingForTrace: this.EnableSerilogRequestResponseLoggingForTrace, enableSerilogRequestResponseLoggingForConsole: this.EnableSerilogRequestResponseLoggingForConsole, enableSerilogRequestResponseLoggingForFile: this.EnableSerilogRequestResponseLoggingForFile, serviceRequestLoggingLocationForFile: this.ServiceRequestLoggingLocationForFile);
-
- }
-
var tokenClient = new TokenClient(tokenEndpoint, ClientID, ClientSecret);
return await tokenClient.RequestTokenFromCodeAsync(code, RedirectURI, cancellationToken: cancellationToken).ConfigureAwait(false);
}
@@ -633,30 +402,10 @@ public string GetAuthorizationURL(List scopes)
{
if (string.IsNullOrEmpty(DiscoveryDoc.TokenEndpoint))
{
- AdvancedLogger.Log("Discovery Call failed. RefreshToken Endpoint is empty.");
+ Logger.Log("Discovery Call failed. RefreshToken Endpoint is empty.");
return new TokenResponse(HttpStatusCode.InternalServerError, "Discovery Call failed. RefreshToken Endpoint is empty.");
}
- AdvancedLoggerEnabled = true;
- //Set internal property to track only informational -intuit_tid based logs
- if (EnableAdvancedLoggerInfoMode == true)
- {
- ShowInfoLogs = true;
- }
-
- if (this.CustomLogger != null)
- {
- //Use custom logger
- AdvancedLogger = LogHelper.GetAdvancedLoggingCustom(this.CustomLogger);
-
-
- }
- else
- {
- //Intialize Logger
- AdvancedLogger = LogHelper.GetAdvancedLogging(enableSerilogRequestResponseLoggingForDebug: this.EnableSerilogRequestResponseLoggingForDebug, enableSerilogRequestResponseLoggingForTrace: this.EnableSerilogRequestResponseLoggingForTrace, enableSerilogRequestResponseLoggingForConsole: this.EnableSerilogRequestResponseLoggingForConsole, enableSerilogRequestResponseLoggingForFile: this.EnableSerilogRequestResponseLoggingForFile, serviceRequestLoggingLocationForFile: this.ServiceRequestLoggingLocationForFile);
- }
-
var tokenClient = new TokenClient(DiscoveryDoc.TokenEndpoint, ClientID, ClientSecret);
return await tokenClient.RequestRefreshTokenAsync(refreshToken, cancellationToken).ConfigureAwait(false);
}
@@ -673,30 +422,10 @@ public string GetAuthorizationURL(List scopes)
{
if (string.IsNullOrEmpty(tokenEndpoint))
{
- AdvancedLogger.Log("RefreshToken Endpoint is empty.");
+ Logger.Log("RefreshToken Endpoint is empty.");
return new TokenResponse(HttpStatusCode.InternalServerError, "RefreshToken Endpoint is empty.");
}
- AdvancedLoggerEnabled = true;
- //Set internal property to track only informational -intuit_tid based logs
- if (EnableAdvancedLoggerInfoMode == true)
- {
- ShowInfoLogs = true;
- }
-
- if (this.CustomLogger != null)
- {
- //Use custom logger
- AdvancedLogger = LogHelper.GetAdvancedLoggingCustom(this.CustomLogger);
-
-
- }
- else
- {
- //Intialize Logger
- AdvancedLogger = LogHelper.GetAdvancedLogging(enableSerilogRequestResponseLoggingForDebug: this.EnableSerilogRequestResponseLoggingForDebug, enableSerilogRequestResponseLoggingForTrace: this.EnableSerilogRequestResponseLoggingForTrace, enableSerilogRequestResponseLoggingForConsole: this.EnableSerilogRequestResponseLoggingForConsole, enableSerilogRequestResponseLoggingForFile: this.EnableSerilogRequestResponseLoggingForFile, serviceRequestLoggingLocationForFile: this.ServiceRequestLoggingLocationForFile);
- }
-
var tokenClient = new TokenClient(tokenEndpoint, ClientID, ClientSecret);
return await tokenClient.RequestRefreshTokenAsync(refreshToken, cancellationToken).ConfigureAwait(false);
}
@@ -711,31 +440,10 @@ public string GetAuthorizationURL(List scopes)
{
if (string.IsNullOrEmpty(DiscoveryDoc.RevocationEndpoint))
{
- AdvancedLogger.Log("Discovery Call failed. RevokeToken Endpoint is empty.");
+ Logger.Log("Discovery Call failed. RevokeToken Endpoint is empty.");
return new TokenRevocationResponse(HttpStatusCode.InternalServerError, "Discovery Call failed. RevokeToken Endpoint is empty.");
}
- AdvancedLoggerEnabled = true;
- //Set internal property to track only informational -intuit_tid based logs
- if (EnableAdvancedLoggerInfoMode == true)
- {
- ShowInfoLogs = true;
- }
-
- if (this.CustomLogger != null)
- {
- //Use custom logger
- AdvancedLogger = LogHelper.GetAdvancedLoggingCustom(this.CustomLogger);
-
-
- }
- else
- {
- //Intialize Logger
- AdvancedLogger = LogHelper.GetAdvancedLogging(enableSerilogRequestResponseLoggingForDebug: this.EnableSerilogRequestResponseLoggingForDebug, enableSerilogRequestResponseLoggingForTrace: this.EnableSerilogRequestResponseLoggingForTrace, enableSerilogRequestResponseLoggingForConsole: this.EnableSerilogRequestResponseLoggingForConsole, enableSerilogRequestResponseLoggingForFile: this.EnableSerilogRequestResponseLoggingForFile, serviceRequestLoggingLocationForFile: this.ServiceRequestLoggingLocationForFile);
- }
-
-
TokenRevocationClient revokeTokenClient = new TokenRevocationClient(DiscoveryDoc.RevocationEndpoint, ClientID, ClientSecret);
return await revokeTokenClient.RevokeAsync(new TokenRevocationRequest
{
@@ -754,31 +462,10 @@ public string GetAuthorizationURL(List scopes)
{
if (string.IsNullOrEmpty(revokeTokenEndpoint))
{
- AdvancedLogger.Log("Revoke Token Endpoint is empty.");
+ Logger.Log("Revoke Token Endpoint is empty.");
return new TokenRevocationResponse(HttpStatusCode.InternalServerError, "Revoke Token Endpoint is empty.");
}
- AdvancedLoggerEnabled = true;
- //Set internal property to track only informational -intuit_tid based logs
- if (EnableAdvancedLoggerInfoMode == true)
- {
- ShowInfoLogs = true;
- }
-
- if (this.CustomLogger != null)
- {
- //Use custom logger
- AdvancedLogger = LogHelper.GetAdvancedLoggingCustom(this.CustomLogger);
-
-
- }
- else
- {
- //Intialize Logger
- AdvancedLogger = LogHelper.GetAdvancedLogging(enableSerilogRequestResponseLoggingForDebug: this.EnableSerilogRequestResponseLoggingForDebug, enableSerilogRequestResponseLoggingForTrace: this.EnableSerilogRequestResponseLoggingForTrace, enableSerilogRequestResponseLoggingForConsole: this.EnableSerilogRequestResponseLoggingForConsole, enableSerilogRequestResponseLoggingForFile: this.EnableSerilogRequestResponseLoggingForFile, serviceRequestLoggingLocationForFile: this.ServiceRequestLoggingLocationForFile);
-
- }
-
TokenRevocationClient revokeTokenClient = new TokenRevocationClient(revokeTokenEndpoint, ClientID, ClientSecret);
return await revokeTokenClient.RevokeAsync(new TokenRevocationRequest
{
@@ -796,31 +483,10 @@ public string GetAuthorizationURL(List scopes)
{
if (string.IsNullOrEmpty(DiscoveryDoc.UserInfoEndpoint))
{
- AdvancedLogger.Log("Discovery Call failed. UserInfo Endpoint is empty.");
+ Logger.Log("Discovery Call failed. UserInfo Endpoint is empty.");
return new UserInfoResponse(HttpStatusCode.InternalServerError, "Discovery Call failed. UserInfo Endpoint is empty.");
}
- AdvancedLoggerEnabled = true;
- //Set internal property to track only informational -intuit_tid based logs
- if (EnableAdvancedLoggerInfoMode == true)
- {
- ShowInfoLogs = true;
- }
-
- if (this.CustomLogger != null)
- {
- //Use custom logger
- AdvancedLogger = LogHelper.GetAdvancedLoggingCustom(this.CustomLogger);
-
-
- }
- else
- {
- //Intialize Logger
- AdvancedLogger = LogHelper.GetAdvancedLogging(enableSerilogRequestResponseLoggingForDebug: this.EnableSerilogRequestResponseLoggingForDebug, enableSerilogRequestResponseLoggingForTrace: this.EnableSerilogRequestResponseLoggingForTrace, enableSerilogRequestResponseLoggingForConsole: this.EnableSerilogRequestResponseLoggingForConsole, enableSerilogRequestResponseLoggingForFile: this.EnableSerilogRequestResponseLoggingForFile, serviceRequestLoggingLocationForFile: this.ServiceRequestLoggingLocationForFile);
-
- }
-
UserInfoClient userInfoClient = new UserInfoClient(DiscoveryDoc.UserInfoEndpoint);
return await userInfoClient.GetAsync(accessToken, cancellationToken).ConfigureAwait(false);
}
@@ -836,31 +502,10 @@ public string GetAuthorizationURL(List scopes)
{
if (string.IsNullOrEmpty(userInfoEndpoint))
{
- AdvancedLogger.Log("UserInfo Endpoint is empty.");
+ Logger.Log("UserInfo Endpoint is empty.");
return new UserInfoResponse(HttpStatusCode.InternalServerError, "UserInfo Endpoint is empty.");
}
- AdvancedLoggerEnabled = true;
- //Set internal property to track only informational -intuit_tid based logs
- if (EnableAdvancedLoggerInfoMode == true)
- {
- ShowInfoLogs = true;
- }
-
- if (this.CustomLogger != null)
- {
- //Use custom logger
- AdvancedLogger = LogHelper.GetAdvancedLoggingCustom(this.CustomLogger);
-
-
- }
- else
- {
- //Intialize Logger
- AdvancedLogger = LogHelper.GetAdvancedLogging(enableSerilogRequestResponseLoggingForDebug: this.EnableSerilogRequestResponseLoggingForDebug, enableSerilogRequestResponseLoggingForTrace: this.EnableSerilogRequestResponseLoggingForTrace, enableSerilogRequestResponseLoggingForConsole: this.EnableSerilogRequestResponseLoggingForConsole, enableSerilogRequestResponseLoggingForFile: this.EnableSerilogRequestResponseLoggingForFile, serviceRequestLoggingLocationForFile: this.ServiceRequestLoggingLocationForFile);
- }
-
-
UserInfoClient userInfoClient = new UserInfoClient(userInfoEndpoint);
return await userInfoClient.GetAsync(accessToken, cancellationToken).ConfigureAwait(false);
}
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/TokenClient.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/TokenClient.cs
index a209bfd6..b6136d32 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/TokenClient.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/TokenClient.cs
@@ -46,12 +46,6 @@ public TokenClient(string endpoint)
/// innerHttpMessageHandler
public TokenClient(string endpoint, HttpMessageHandler innerHttpMessageHandler)
{
- if (OAuth2Client.AdvancedLoggerEnabled == false)
- {
- //Intialize Logger
- OAuth2Client.AdvancedLogger = LogHelper.GetAdvancedLogging(enableSerilogRequestResponseLoggingForDebug: false, enableSerilogRequestResponseLoggingForTrace: false, enableSerilogRequestResponseLoggingForConsole: false, enableSerilogRequestResponseLoggingForFile: false, serviceRequestLoggingLocationForFile: System.IO.Path.GetTempPath());
- }
-
if (endpoint == null) throw new ArgumentNullException(nameof(endpoint));
if (innerHttpMessageHandler == null) throw new ArgumentNullException(nameof(innerHttpMessageHandler));
@@ -114,6 +108,18 @@ public TokenClient(string endpoint, string clientId, string clientSecret, HttpMe
///
public AuthenticationStyle AuthenticationStyle { get; set; }
+ private IOAuthLogger logger;
+
+ ///
+ /// Logger for OAuth requests and responses.
+ /// Defaults to .
+ ///
+ public IOAuthLogger Logger
+ {
+ get => logger ?? NullOAuthLogger.Instance;
+ set => logger = value;
+ }
+
///
/// TimeOut
///
@@ -145,15 +151,13 @@ public TimeSpan Timeout
request.Content.Headers.ContentType = new MediaTypeWithQualityHeaderValue("application/x-www-form-urlencoded");
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
}
- if (OAuth2Client.AdvancedLoggerEnabled != false)
+
+ Logger.LogRequest(Client, request);
+ if (Logger.ShouldLogRequestBody())
{
- OAuth2Client.AdvancedLogger.Log("Request url- " + Address);
- OAuth2Client.AdvancedLogger.Log("Request headers- ");
- OAuth2Client.AdvancedLogger.Log("Authorization Header: " + request.Headers.Authorization.ToString());
- OAuth2Client.AdvancedLogger.Log("ContentType header: " + request.Content.Headers.ContentType.ToString());
- OAuth2Client.AdvancedLogger.Log("Accept header: " + "application/json");
- OAuth2Client.AdvancedLogger.Log("Request Body: " + await request.Content.ReadAsStringAsync().ConfigureAwait(false));
+ Logger.LogRequestBody(await request.Content.ReadAsStringAsync().ConfigureAwait(false));
}
+
try
{
response = await Client.SendAsync(request, cancellationToken).ConfigureAwait(false);
@@ -175,13 +179,7 @@ public TimeSpan Timeout
}
var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);//errorDetail can be added here if required for BadRequest.
- if (OAuth2Client.AdvancedLoggerEnabled != false)
- {
- if (OAuth2Client.ShowInfoLogs == true)//log just intuit_tid for info logging mode
- OAuth2Client.AdvancedLogger.Log("Response Intuit_Tid header - " + intuit_tid + ", Response Status Code- " + response.StatusCode);
- else
- OAuth2Client.AdvancedLogger.Log("Response Intuit_Tid header - " + intuit_tid + ", Response Status Code- " + response.StatusCode + ", Response Body- " + content);
- }
+ Logger.LogResponse(response, intuit_tid, body: content);
return new TokenResponse(content);
}
else
@@ -195,26 +193,12 @@ public TimeSpan Timeout
if (errorDetail != null && errorDetail != "")
{
- if (OAuth2Client.AdvancedLoggerEnabled != false)
- {
- if (OAuth2Client.ShowInfoLogs == true)//log just intuit_tid for info logging mode
- OAuth2Client.AdvancedLogger.Log("Response: Status Code- " + response.StatusCode);
- else
- OAuth2Client.AdvancedLogger.Log("Response: Status Code- " + response.StatusCode + ", Error Details- " + response.ReasonPhrase + ": " + errorDetail);
-
- }
+ Logger.LogResponseError(response, errorDetail);
return new TokenResponse(response.StatusCode, response.ReasonPhrase + ": " + errorDetail);
}
else
{
- if (OAuth2Client.AdvancedLoggerEnabled != false)
- {
- if (OAuth2Client.ShowInfoLogs == true)//log just intuit_tid for info logging mode
- OAuth2Client.AdvancedLogger.Log("Response: Status Code- " + response.StatusCode);
- else
- OAuth2Client.AdvancedLogger.Log("Response: Status Code- " + response.StatusCode + ", Error Details- " + response.ReasonPhrase);
-
- }
+ Logger.LogResponseError(response);
return new TokenResponse(response.StatusCode, response.ReasonPhrase);
}
}
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/TokenClientExtensions.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/TokenClientExtensions.cs
index b3332c8a..1c4ad2f5 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/TokenClientExtensions.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/TokenClientExtensions.cs
@@ -28,10 +28,7 @@ public static class TokenClientExtensions
/// task of TokenResponse
public static Task RequestTokenFromCodeAsync(this TokenClient client, string code, string redirectUri, string codeVerifier = null, object extra = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (OAuth2Client.AdvancedLoggerEnabled != false)
- {
- OAuth2Client.AdvancedLogger.Log("Access/Bearer token request initiated");
- }
+ client.Logger.Log("Access/Bearer token request initiated");
var fields = new Dictionary
{
{ OidcConstants.TokenRequest.GrantType, OidcConstants.GrantTypes.AuthorizationCode },
@@ -55,10 +52,7 @@ public static class TokenClientExtensions
/// task of TokenResponse
public static Task RequestRefreshTokenAsync(this TokenClient client, string refreshToken, object extra = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (OAuth2Client.AdvancedLoggerEnabled != false)
- {
- OAuth2Client.AdvancedLogger.Log("Refresh token request initiated");
- }
+ client.Logger.Log("Refresh token request initiated");
var fields = new Dictionary
{
{ OidcConstants.TokenRequest.GrantType, OidcConstants.GrantTypes.RefreshToken },
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/TokenRevocationClient.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/TokenRevocationClient.cs
index c22f1b6b..a1eb0ad1 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/TokenRevocationClient.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/TokenRevocationClient.cs
@@ -65,12 +65,6 @@ public class TokenRevocationClient : IDisposable
/// innerHttpMessageHandler
public TokenRevocationClient(string endpoint, string clientId = "", string clientSecret = "", HttpMessageHandler innerHttpMessageHandler = null)
{
- if (OAuth2Client.AdvancedLoggerEnabled == false)
- {
- //Intialize Logger
- OAuth2Client.AdvancedLogger = LogHelper.GetAdvancedLogging(enableSerilogRequestResponseLoggingForDebug: false, enableSerilogRequestResponseLoggingForTrace: false, enableSerilogRequestResponseLoggingForConsole: false, enableSerilogRequestResponseLoggingForFile: false, serviceRequestLoggingLocationForFile: System.IO.Path.GetTempPath());
- }
-
if (endpoint == null) throw new ArgumentNullException(nameof(endpoint));
if (innerHttpMessageHandler == null) innerHttpMessageHandler = new HttpClientHandler();
@@ -91,6 +85,18 @@ public TokenRevocationClient(string endpoint, string clientId = "", string clien
Address = endpoint;
}
+ private IOAuthLogger logger;
+
+ ///
+ /// Logger for OAuth requests and responses.
+ /// Defaults to .
+ ///
+ public IOAuthLogger Logger
+ {
+ get => logger ?? NullOAuthLogger.Instance;
+ set => logger = value;
+ }
+
///
/// Timeout
///
@@ -124,19 +130,15 @@ public virtual async Task RevokeAsync(
msgRequest.Content = stringContent;
- if (OAuth2Client.AdvancedLoggerEnabled != false)
+ Logger.LogRequest(Client, msgRequest);
+ if (Logger.ShouldLogRequestBody())
{
- OAuth2Client.AdvancedLogger.Log("Request url- " + Address);
- OAuth2Client.AdvancedLogger.Log("Request headers- ");
- OAuth2Client.AdvancedLogger.Log("Authorization Header: " + Client.DefaultRequestHeaders.Authorization.ToString());//check
- OAuth2Client.AdvancedLogger.Log("ContentType header: " + "application/json");
- OAuth2Client.AdvancedLogger.Log("Accept header: " + "application/json");
- OAuth2Client.AdvancedLogger.Log("Request Body: " + await msgRequest.Content.ReadAsStringAsync().ConfigureAwait(false));
+ Logger.LogRequestBody(await msgRequest.Content.ReadAsStringAsync().ConfigureAwait(false));
}
try
{
- var response = await Client.PostAsync("", msgRequest.Content).ConfigureAwait(false);
+ var response = await Client.SendAsync(msgRequest).ConfigureAwait(false);
HttpResponseHeaders headers = response.Headers;
@@ -153,13 +155,7 @@ public virtual async Task RevokeAsync(
intuit_tid = "None";
}
- if (OAuth2Client.AdvancedLoggerEnabled != false)
- {
- if (OAuth2Client.ShowInfoLogs == true)//log just intuit_tid for info logging mode
- OAuth2Client.AdvancedLogger.Log("Response Intuit_Tid header - " + intuit_tid + ", Response Status Code- " + response.StatusCode + ", Token Revoked successfully");
- else
- OAuth2Client.AdvancedLogger.Log("Response Intuit_Tid header - " + intuit_tid + ", Response Status Code- " + response.StatusCode + ", Token Revoked successfully");
- }
+ Logger.LogResponse(response, intuit_tid, message: "Token Revoked successfully");
return new TokenRevocationResponse();
}
else if (response.StatusCode == HttpStatusCode.BadRequest)
@@ -176,13 +172,7 @@ public virtual async Task RevokeAsync(
}
var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
- if (OAuth2Client.AdvancedLoggerEnabled != false)
- {
- if (OAuth2Client.ShowInfoLogs == true)//log just intuit_tid for info logging mode
- OAuth2Client.AdvancedLogger.Log("Response Intuit_Tid header - " + intuit_tid + ", Response Status Code- " + response.StatusCode);
- else
- OAuth2Client.AdvancedLogger.Log("Response Intuit_Tid header - " + intuit_tid + ", Response Status Code- " + response.StatusCode + ", Response Body- " + content);
- }
+ Logger.LogResponse(response, intuit_tid, body: content);
return new TokenRevocationResponse(content); //errorDetail can be added here if required.
}
else
@@ -197,24 +187,12 @@ public virtual async Task RevokeAsync(
if (errorDetail != null && errorDetail != "")
{
- if (OAuth2Client.AdvancedLoggerEnabled != false)
- {
- if (OAuth2Client.ShowInfoLogs == true)//log just intuit_tid for info logging mode
- OAuth2Client.AdvancedLogger.Log("Response: Status Code- " + response.StatusCode);
- else
- OAuth2Client.AdvancedLogger.Log("Response: Status Code- " + response.StatusCode + ", Error Details- " + response.ReasonPhrase + ": " + errorDetail);
- }
+ Logger.LogResponse(response, errorDetail);
return new TokenRevocationResponse(response.StatusCode, response.ReasonPhrase + ": " + errorDetail);
}
else
{
- if (OAuth2Client.AdvancedLoggerEnabled != false)
- {
- if (OAuth2Client.ShowInfoLogs == true)//log just intuit_tid for info logging mode
- OAuth2Client.AdvancedLogger.Log("Response: Status Code- " + response.StatusCode);
- else
- OAuth2Client.AdvancedLogger.Log("Response: Status Code- " + response.StatusCode + ", Error Details- " + response.ReasonPhrase + ": " + errorDetail);
- }
+ Logger.LogResponse(response);
return new TokenRevocationResponse(response.StatusCode, response.ReasonPhrase);
}
}
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/TokenRevocationClientExtensions.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/TokenRevocationClientExtensions.cs
index 58885250..135e9000 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/TokenRevocationClientExtensions.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/TokenRevocationClientExtensions.cs
@@ -21,7 +21,7 @@ public static class TokenRevocationClientExtensions
/// Task of TokenRevocationResponse
public static Task RevokeAccessTokenAsync(this TokenRevocationClient client, string token, CancellationToken cancellationToken = default(CancellationToken))
{
- OAuth2Client.AdvancedLogger.Log("Revoke Access token request initiated");
+ client.Logger.Log("Revoke Access token request initiated");
return client.RevokeAsync(new TokenRevocationRequest
{
Token = token,
@@ -37,7 +37,7 @@ public static class TokenRevocationClientExtensions
/// Task of TokenRevocationResponse
public static Task RevokeRefreshTokenAsync(this TokenRevocationClient client, string token, CancellationToken cancellationToken = default(CancellationToken))
{
- OAuth2Client.AdvancedLogger.Log("Revoke Refresh token request initiated");
+ client.Logger.Log("Revoke Refresh token request initiated");
return client.RevokeAsync(new TokenRevocationRequest
{
Token = token,
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/UserInfoClient.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/UserInfoClient.cs
index 31e74548..3c4f2f63 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/UserInfoClient.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Client/UserInfoClient.cs
@@ -36,12 +36,6 @@ public UserInfoClient(string endpoint)
/// innerHttpMessageHandler
public UserInfoClient(string endpoint, HttpMessageHandler innerHttpMessageHandler)
{
- if (OAuth2Client.AdvancedLoggerEnabled == false)
- {
- //Intialize Logger
- OAuth2Client.AdvancedLogger = LogHelper.GetAdvancedLogging(enableSerilogRequestResponseLoggingForDebug: false, enableSerilogRequestResponseLoggingForTrace: false, enableSerilogRequestResponseLoggingForConsole: false, enableSerilogRequestResponseLoggingForFile: false, serviceRequestLoggingLocationForFile: System.IO.Path.GetTempPath());
- }
-
if (endpoint == null) throw new ArgumentNullException(nameof(endpoint));
if (innerHttpMessageHandler == null) throw new ArgumentNullException(nameof(innerHttpMessageHandler));
@@ -54,12 +48,18 @@ public UserInfoClient(string endpoint, HttpMessageHandler innerHttpMessageHandle
_client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
_client.DefaultRequestHeaders.Add("Connection", "close");
+ }
- if (OAuth2Client.AdvancedLoggerEnabled != false)
- {
- OAuth2Client.AdvancedLogger.Log("UserInfo request initiated");
- OAuth2Client.AdvancedLogger.Log("Request url- " + endpoint);
- }
+ private IOAuthLogger logger;
+
+ ///
+ /// Logger for OAuth requests and responses.
+ /// Defaults to .
+ ///
+ public IOAuthLogger Logger
+ {
+ get => logger ?? NullOAuthLogger.Instance;
+ set => logger = value;
}
///
@@ -90,15 +90,12 @@ public TimeSpan Timeout
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
- if (OAuth2Client.AdvancedLoggerEnabled != false)
+ Logger.LogRequest(_client, request);
+ if (Logger.ShouldLogRequestBody())
{
- OAuth2Client.AdvancedLogger.Log("Request headers- ");
- OAuth2Client.AdvancedLogger.Log("Authorization Header: " + request.Headers.Authorization.ToString());
-
- OAuth2Client.AdvancedLogger.Log("Accept header: " + "application/json");
+ Logger.LogRequestBody(await request.Content.ReadAsStringAsync().ConfigureAwait(false));
}
-
HttpResponseMessage response;
try
{
@@ -131,40 +128,19 @@ public TimeSpan Timeout
if (errorDetail != null && errorDetail != "")
{
- if (OAuth2Client.AdvancedLoggerEnabled != false)
- {
- if (OAuth2Client.ShowInfoLogs == true)//log just intuit_tid for info logging mode
- OAuth2Client.AdvancedLogger.Log("Response Intuit_Tid header - " + intuit_tid + ", Response: Status Code- " + response.StatusCode);
- else
- OAuth2Client.AdvancedLogger.Log("Response Intuit_Tid header - " + intuit_tid + ", Response: Status Code- " + response.StatusCode + ", Error Details- " + response.ReasonPhrase + ": " + errorDetail);
-
- }
+ Logger.LogResponseError(response, errorDetail);
return new UserInfoResponse(response.StatusCode, response.ReasonPhrase + ": " + errorDetail);
}
else
{
- if (OAuth2Client.AdvancedLoggerEnabled != false)
- {
-
- if (OAuth2Client.ShowInfoLogs == true)//log just intuit_tid for info logging mode
- OAuth2Client.AdvancedLogger.Log("Response Intuit_Tid header - " + intuit_tid + ", Response: Status Code- " + response.StatusCode);
- else
- OAuth2Client.AdvancedLogger.Log("Response Intuit_Tid header - " + intuit_tid + ", Response: Status Code- " + response.StatusCode + ", Error Details- " + response.ReasonPhrase);
-
- }
+ Logger.LogResponseError(response);
return new UserInfoResponse(response.StatusCode, response.ReasonPhrase);
}
}
var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
- if (OAuth2Client.AdvancedLoggerEnabled != false)
- {
- if (OAuth2Client.ShowInfoLogs == true)//log just intuit_tid for info logging mode
- OAuth2Client.AdvancedLogger.Log("Response Intuit_Tid header - " + intuit_tid + ", Response Status Code- " + response.StatusCode);
- else
- OAuth2Client.AdvancedLogger.Log("Response Intuit_Tid header - " + intuit_tid + ", Response Status Code- " + response.StatusCode + ", Response Body- " + content);
- }
+ Logger.LogResponse(response, intuit_tid, body: content);
return new UserInfoResponse(content);
}
catch (System.Exception ex)
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Intuit.Ipp.OAuth2PlatformClient.csproj b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Intuit.Ipp.OAuth2PlatformClient.csproj
index de6b5203..aa114cc6 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Intuit.Ipp.OAuth2PlatformClient.csproj
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.OAuth2PlatformClient/Intuit.Ipp.OAuth2PlatformClient.csproj
@@ -9,7 +9,6 @@
-
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Utility.Test/IppConfigurationSectionTest.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Utility.Test/IppConfigurationSectionTest.cs
index 6ee419bf..4cb9f359 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Utility.Test/IppConfigurationSectionTest.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Utility.Test/IppConfigurationSectionTest.cs
@@ -81,9 +81,6 @@ public void InstanceTest()
Assert.IsNotNull(actual.WebhooksService.WebhooksVerifier.Value);
Assert.IsNotNull(actual);
Assert.IsNotNull(actual.Logger);
- Assert.IsNotNull(actual.Logger.RequestLog);
- Assert.IsTrue(actual.Logger.RequestLog.EnableRequestResponseLogging);
- Assert.IsNotNull(actual.Logger.RequestLog.RequestResponseLoggingDirectory);
Assert.IsNotNull(actual.Logger.CustomLogger);
Assert.IsNotNull(actual.Logger.CustomLogger.Name);
Assert.IsNotNull(actual.Logger.CustomLogger.Type);
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Utility/Configuration/LoggerElement.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Utility/Configuration/LoggerElement.cs
index 9ea1104f..453e65ea 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Utility/Configuration/LoggerElement.cs
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Utility/Configuration/LoggerElement.cs
@@ -27,18 +27,6 @@ namespace Intuit.Ipp.Utility
///
public class LoggerElement : ConfigurationElement
{
- ///
- /// Gets the RequestLog element.
- ///
- [ConfigurationProperty("requestLog")]
- public RequestLogElement RequestLog
- {
- get
- {
- return (RequestLogElement)this["requestLog"];
- }
- }
-
///
/// Gets the CustomLogger element.
///
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Utility/Configuration/RequestLogElement.cs b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Utility/Configuration/RequestLogElement.cs
deleted file mode 100644
index fb76135d..00000000
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Utility/Configuration/RequestLogElement.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-////*********************************************************
-//
-/*******************************************************************************
- * Copyright 2016 Intuit
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *******************************************************************************/
-// This file contains Request log element.
-////*********************************************************
-
-namespace Intuit.Ipp.Utility
-{
- using System.Configuration;
-
- ///
- /// Request log element.
- ///
- public class RequestLogElement : ConfigurationElement
- {
- ///
- /// Gets a value indicating whether to log request and response messages.
- ///
- [ConfigurationProperty("enableRequestResponseLogging")]
- public bool EnableRequestResponseLogging
- {
- get
- {
- return (bool)this["enableRequestResponseLogging"];
- }
- }
-
- ///
- /// Gets the logging directory.
- ///
- [ConfigurationProperty("requestResponseLoggingDirectory")]
- public string RequestResponseLoggingDirectory
- {
- get
- {
- return this["requestResponseLoggingDirectory"].ToString();
- }
- }
- }
-}
diff --git a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Utility/Intuit.Ipp.Utility.csproj b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Utility/Intuit.Ipp.Utility.csproj
index 2f58c0e2..041065d5 100644
--- a/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Utility/Intuit.Ipp.Utility.csproj
+++ b/IPPDotNetDevKitCSV3/Code/Intuit.Ipp.Utility/Intuit.Ipp.Utility.csproj
@@ -7,6 +7,7 @@
+
@@ -27,7 +28,4 @@
Resources.Designer.cs
-
-
-
\ No newline at end of file
diff --git a/IPPDotNetDevKitCSV3/Code/TestSDK/App_Code/CLogger.cs b/IPPDotNetDevKitCSV3/Code/TestSDK/App_Code/CLogger.cs
deleted file mode 100644
index 23165cfd..00000000
--- a/IPPDotNetDevKitCSV3/Code/TestSDK/App_Code/CLogger.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
-using Serilog;
-using Serilog.Sinks.File;
-using Serilog.Core;
-using Serilog.Events;
-
-using System.IO;
-
-namespace TestSDK
-{
-
- ///
- /// Summary description for CLogger2
- ///
-
- public class CLogger // : ILogger
- {
- public Logger customLogger;
- public Logger GetCustomLogger()
- {
-
- //Log file path for widows n ios
- string filePath = Path.Combine("C:\\Users\\nshrivastava\\Documents\\Serilog_log", "QBOApiLogs-" + DateTime.Now.Ticks.ToString() + ".txt");
-
-
-
- //Setting logger config for Serilog
- var loggerConfig = new LoggerConfiguration()
- .MinimumLevel.Verbose()
- .WriteTo.File(filePath);
-
- customLogger = loggerConfig.CreateLogger();
- return customLogger;
-
-
- }
- }
-}
\ No newline at end of file
diff --git a/IPPDotNetDevKitCSV3/Code/TestSDK/Default2.aspx.cs b/IPPDotNetDevKitCSV3/Code/TestSDK/Default2.aspx.cs
index 59b25d60..012eab58 100644
--- a/IPPDotNetDevKitCSV3/Code/TestSDK/Default2.aspx.cs
+++ b/IPPDotNetDevKitCSV3/Code/TestSDK/Default2.aspx.cs
@@ -29,7 +29,6 @@
using System.Linq;
using Intuit.Ipp.ReportService;
using Intuit.Ipp.Diagnostics;
-using Serilog;
namespace TestSDK
@@ -66,18 +65,6 @@ protected void Page_PreInit(object sender, EventArgs e)
protected async void Page_Load(object sender, EventArgs e)
{
- CLogger cu = new CLogger();
-
- oauthClient.CustomLogger = cu.GetCustomLogger();
- oauthClient.EnableAdvancedLoggerInfoMode = true;
- oauthClient.EnableSerilogRequestResponseLoggingForConsole = true;
- oauthClient.EnableSerilogRequestResponseLoggingForDebug = true;
- oauthClient.EnableSerilogRequestResponseLoggingForFile = true;
- oauthClient.EnableSerilogRequestResponseLoggingForTrace = true;
- oauthClient.ServiceRequestLoggingLocationForFile = @"C:\Documents\Serilog_log";//check correct path on machine
-
- //SeriLogger seri = new SeriLogger();
- //seri.Log(TraceLevel.Verbose, "Nimisha typing");
AsyncMode = true;
if (!dictionary.ContainsKey("accessToken"))
{
@@ -91,7 +78,6 @@ protected async void Page_Load(object sender, EventArgs e)
//{
if (response.RealmId != null)
{
- // seri.Log(TraceLevel.Verbose, response.RealmId);
if (!dictionary.ContainsKey("realmId"))
{
dictionary.Add("realmId", response.RealmId);
@@ -318,16 +304,7 @@ public async System.Threading.Tasks.Task QboApiCall()
context.IppConfiguration.BaseUrl.Qbo = "https://sandbox-quickbooks.api.intuit.com/";
// //serviceContext.IppConfiguration.BaseUrl.Qbo = "https://quickbooks.api.intuit.com/";//prod
context.IppConfiguration.MinorVersion.Qbo = "62";
- //context.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging =
- //context.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\Documents\Serilog_log";
-
- CLogger cu = new CLogger();
- context.IppConfiguration.AdvancedLogger.RequestAdvancedLog.CustomLogger = cu.GetCustomLogger();
- //context.IppConfiguration.AdvancedLogger.RequestAdvancedLog.EnableSerilogRequestResponseLoggingForRollingFile = true;
- //context.IppConfiguration.AdvancedLogger.RequestAdvancedLog.EnableSerilogRequestResponseLoggingForConsole = true;
- //context.IppConfiguration.AdvancedLogger.RequestAdvancedLog.EnableSerilogRequestResponseLoggingForTrace = true;
- //context.IppConfiguration.AdvancedLogger.RequestAdvancedLog.EnableSerilogRequestResponseLoggingForDebug = true;
- //context.IppConfiguration.AdvancedLogger.RequestAdvancedLog.ServiceRequestLoggingLocationForFile = @"C:\Documents\Serilog_log";
+
QueryService in2 = new QueryService(context);
var inn22 = in2.ExecuteIdsQueryForCount("Select * From Invoice");
var inn23 = in2.ExecuteIdsQueryForCount("Select count(*) From Invoice");
diff --git a/IPPDotNetDevKitCSV3/Code/TestSDK/Web.config b/IPPDotNetDevKitCSV3/Code/TestSDK/Web.config
index b85733b4..a69c9334 100644
--- a/IPPDotNetDevKitCSV3/Code/TestSDK/Web.config
+++ b/IPPDotNetDevKitCSV3/Code/TestSDK/Web.config
@@ -65,10 +65,6 @@
-
-
-
-
diff --git a/IPPDotNetDevKitCSV3/Code/TestSDK/packages.config b/IPPDotNetDevKitCSV3/Code/TestSDK/packages.config
index c924476f..5c101449 100644
--- a/IPPDotNetDevKitCSV3/Code/TestSDK/packages.config
+++ b/IPPDotNetDevKitCSV3/Code/TestSDK/packages.config
@@ -3,8 +3,6 @@
-
-
diff --git a/IPPDotNetDevKitCSV3/Test/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj b/IPPDotNetDevKitCSV3/Test/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj
index 4d5ef845..c7724f66 100644
--- a/IPPDotNetDevKitCSV3/Test/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj
+++ b/IPPDotNetDevKitCSV3/Test/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj
@@ -36,11 +36,6 @@
-
-
-
-
-
diff --git a/README.md b/README.md
index 3c1cdabd..ba76191f 100644
--- a/README.md
+++ b/README.md
@@ -90,49 +90,24 @@ The code has been divided into following main categories-
## Enabling logs for the SDK
-Logs help you in easliy identifying detailed issues with your payload, get more info in the exception details for fixing them.
-* New logging support was added to the SDK which includes support for reporting headers and multiple logging sinks available from Serilog. You can chooise to have either one or more of these logging sinks enabled. -
-Serilogger logs can be enabled for **OAuth2PlatformClient** using the following lines -
-
- static OAuth2Client oauthClient = new OAuth2Client(clientID, clientSecret, redirectURI, appEnvironment);
- //Use this line to enable only intuit-tid based logs, no tokens/response will be logged.
- //If set to false, all detailed logs will be available for response
- //If set to true, only intuit-tid response headers will be available
-
- // This will work with both custom logger or already supported serilog logger sinks in the SDK
- oauthClient.EnableAdvancedLoggerInfoMode = true;
-
- // Option for devs to use this for setting their own custom logger
- //Adding support for custom logger where value can be an instance of Serilog.Core.ILogger
- oauthClient.CustomLogger = ;
-
- //Already supported logger in the SDK. Either use custom logger or the below statements for serilog logs to work.
- oauthClient.EnableSerilogRequestResponseLoggingForConsole = true;
- oauthClient.EnableSerilogRequestResponseLoggingForDebug = true;
- oauthClient.EnableSerilogRequestResponseLoggingForFile = true;
- oauthClient.EnableSerilogRequestResponseLoggingForTrace = true;
- oauthClient.ServiceRequestLoggingLocationForFile = @"C:\Documents\Serilog_log";//Any drive logging location
-
-
-Serilogger logs can be enabled for **QBO API calls** using the following lines -
-
- ServiceContext context = new ServiceContext(dictionary["realmId"], IntuitServicesType.QBO, oauthValidator);
-
- //Adding support for custom logger where value can be an instance of Serilog.Core.ILogger
- context.IppConfiguration.AdvancedLogger.RequestAdvancedLog.CustomLogger = ;
-
- //Already supported logger in the SDK. Either use custom logger or the below statements for serilog logs to work.
- context.IppConfiguration.AdvancedLogger.RequestAdvancedLog.EnableSerilogRequestResponseLoggingForFile = true;
- context.IppConfiguration.AdvancedLogger.RequestAdvancedLog.EnableSerilogRequestResponseLoggingForConsole = true;
- context.IppConfiguration.AdvancedLogger.RequestAdvancedLog.EnableSerilogRequestResponseLoggingForTrace = true;
- context.IppConfiguration.AdvancedLogger.RequestAdvancedLog.EnableSerilogRequestResponseLoggingForDebug = true;
- context.IppConfiguration.AdvancedLogger.RequestAdvancedLog.ServiceRequestLoggingLocationForFile = @"C:\Documents\Serilog_log"; //Any drive logging location
-
-Old file based logs can be enabled by using the following lines-
+
+### Basic Logging
+
+Most logging uses `IppConfiguration.Logger`, which has one property:
+- `CustomLogger` allows providing an implementation of `Intuit.IppDiagnostics.ILogger` (default: `Intuit.Ipp.Diagnostics.TraceLogger`).
- context.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true;
- context.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\Documents\Serilog_log"; //Any drive logging location
-
+### Advanced Logging
+
+Request/response logging uses `IppConfiguration.AdvancedLogger`, which has one property:
+- `Logger` allows providing an implementation of `Intuit.IppDiagnostics.IAdvancedLogger` (default: `Intuit.Ipp.Diagnostics.TraceLogger`).
+
+### OAuth Logging
+
+The clients in `Intuit.Ipp.OAuth2PlatformClient` have a `Logger` property that can be assigned with an implementation of `Intuit.Ipp.OAuth2PlatformClient.Diagnostics.IOAuthLogger`.
+- `OAuth2Client`, `TokenClient`, `TokenRevocationClient`, and `UserInfoClient` default to `NullOAuthLogger`.
+
+## Fiddler
+
* **Fiddler logs are really useful too. You can enable them by following the steps below**
Download Fiddler from Google and run it alongside your code to log raw requests and responses along with URL and headers.