Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ public interface ISettings
/// </summary>
bool LogResponseErrors { get; set; }

/// <summary>
/// Gets or sets a value that determines if order creation requests and responses should always be logged.
/// </summary>
bool LogOrderCreationRequests { get; set; }

/// <summary>
/// Gets or sets the recipient's email address for notification emails.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,12 @@ public string InstanceName
/// <value><c>true</c> if a copy should be saved; otherwise, <c>false</c>.</value>
public bool SaveCopyOfOrderXml { get; set; }

/// <summary>
/// Gets or sets a value that determines if order creation requests and responses should always be logged,
/// even when general request/response logging is disabled.
/// </summary>
public bool LogOrderCreationRequests { get; set; }

#endregion Logs parameters

/// <summary>
Expand Down Expand Up @@ -481,6 +487,7 @@ public static void UpdateFrom(ISettings source, ISettings target)
target.LogResponseErrors = source.LogResponseErrors;
target.LogGeneralErrors = source.LogGeneralErrors;
target.LogDebugInfo = source.LogDebugInfo;
target.LogOrderCreationRequests = source.LogOrderCreationRequests;
target.LogMaxSize = source.LogMaxSize;
target.KeepLogFiles = source.KeepLogFiles;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>10.21.7</Version>
<Version>10.21.8</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<Title>Live Integration</Title>
<Description>Live Integration</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,15 @@ public LiveIntegrationAddIn()
[AddInParameterOrder(370)]
public bool LogDebugInfo { get; set; }

/// <summary>
/// Gets or sets a value that determines if order creation requests and responses should always be logged.
/// </summary>
[AddInParameter("Log order creation request and response")]
[AddInParameterEditor(typeof(YesNoParameterEditor), "")]
[AddInParameterGroup("Logs")]
[AddInParameterOrder(375)]
public bool LogOrderCreationRequests { get; set; }

#endregion Logs parameters

#endregion Configuration parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ public Logger(Settings settings)
/// <value><c>true</c> if [log debug information]; otherwise, <c>false</c>.</value>
private bool LogDebugInfo => _settings.LogDebugInfo;

/// <summary>
/// Set to true before an order-creation ERP call to enable per-call logging
/// when <see cref="Settings.LogOrderCreationRequests"/> is on but general debug
/// logging is off. Reset to false immediately after the call.
/// </summary>
public bool IsOrderCreationContext { get; set; }

/// <summary>
/// Gets or sets a value that determines if general info should be logged.
/// </summary>
Expand Down Expand Up @@ -169,19 +176,19 @@ private bool IsAllowedAddToLog(ErrorLevel level)
switch (level)
{
case ErrorLevel.ConnectionError:
result = LogConnectionErrors;
result = LogConnectionErrors || (IsOrderCreationContext && _settings.LogOrderCreationRequests);
break;

case ErrorLevel.ResponseError:
result = LogResponseErrors;
result = LogResponseErrors || (IsOrderCreationContext && _settings.LogOrderCreationRequests);
break;

case ErrorLevel.Error:
result = LogGeneralErrors;
break;

case ErrorLevel.DebugInfo:
result = LogDebugInfo;
result = LogDebugInfo || (IsOrderCreationContext && _settings.LogOrderCreationRequests);
break;

case ErrorLevel.EmailSend:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ private static ResponseCacheLevel GetOrderCacheLevel(Settings settings)

var ctx = new OrderResponseContext(settings, erpControlsDiscount);

logger.IsOrderCreationContext = createOrder;
XmlDocument response = GetResponse(ctx, requestXml, order, createOrder, logger, out bool? requestCancelled, liveIntegrationSubmitType);
logger.IsOrderCreationContext = false;
if (response != null && !string.IsNullOrWhiteSpace(response.InnerXml))
{
bool processResponseResult = ProcessResponse(ctx, response, order, createOrder, successOrderStateId, failedOrderStateId, logger);
Expand Down
Loading