Improve logging
This commit is contained in:
parent
cd1cdfe19a
commit
bc8289e1b7
@ -398,6 +398,10 @@ Namespace Documents
|
||||
Dim oFunctionName = oColumn.Config.FunctionName
|
||||
Dim oFunctionParams = oColumn.Config.FunctionParams
|
||||
|
||||
If oFunctionName = String.Empty Then
|
||||
Continue For
|
||||
End If
|
||||
|
||||
Logger.Debug("Running Function: [{0}]", oFunctionName)
|
||||
Logger.Debug("With Parameters: [{0}]", oFunctionParams)
|
||||
|
||||
|
||||
@ -52,6 +52,7 @@ Namespace Winline
|
||||
Dim oWS = Config
|
||||
|
||||
RaiseEvent WebServiceProgress(Me, "Einstellungen laden")
|
||||
Logger.Debug("Loading setting and creating directories")
|
||||
|
||||
' --- Build all teh filenamez and pathz
|
||||
Dim oBaseFileName As String = FileEx.GetDateTimeString()
|
||||
@ -72,12 +73,14 @@ Namespace Winline
|
||||
Dim oImportRelativeFilePath = IO.Path.Combine(oRelativePath, oFileName)
|
||||
|
||||
RaiseEvent WebServiceProgress(Me, "Dateien schreiben")
|
||||
Logger.Debug("Writing request file to [{oOutputFilePath}]")
|
||||
|
||||
' --- Serialize Data into XML string
|
||||
IO.File.WriteAllBytes(oOutputFilePath, oBytes)
|
||||
|
||||
' --- Copy file to Winline Import Directory
|
||||
Try
|
||||
Logger.Debug("Copying request file to [{oImportAbsoluteFilePath}]")
|
||||
IO.File.Copy(oOutputFilePath, oImportAbsoluteFilePath, True)
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
@ -87,6 +90,7 @@ Namespace Winline
|
||||
' --- Prepare URL and HTTP Client
|
||||
Dim oTemplateType = pDocument.TemplateType
|
||||
Dim oTemplateName = pDocument.TemplateName
|
||||
Logger.Debug("Using Template [{0}/{1}]", oTemplateName, oTemplateType)
|
||||
|
||||
' ActionCode: Should this be a test or not?
|
||||
' 0 = Test call
|
||||
@ -95,6 +99,7 @@ Namespace Winline
|
||||
If pIsTest = True Then
|
||||
oActionCode = 0
|
||||
End If
|
||||
Logger.Debug("Using ActionCode [{0}]", oActionCode)
|
||||
|
||||
' Byref: Should data be supplied as file or as string?
|
||||
' 0 = As String
|
||||
@ -113,6 +118,8 @@ Namespace Winline
|
||||
' --- Bring the action!
|
||||
Try
|
||||
Dim oResponse As HttpResponseMessage = Await oClient.GetAsync(oURL)
|
||||
Logger.Debug("HTTP Response recevied!")
|
||||
|
||||
Await HandleImportResponse(oResponse, pTemplate, oBaseFileName)
|
||||
|
||||
Return True
|
||||
@ -133,8 +140,12 @@ Namespace Winline
|
||||
|
||||
RaiseEvent WebServiceProgress(Me, "Antwort verarbeiten")
|
||||
|
||||
Logger.Debug("Response ContentType: [{0}]", oContentType)
|
||||
|
||||
Select Case oContentType
|
||||
Case "text/xml"
|
||||
Logger.Debug("Got XML Response. Checking.")
|
||||
|
||||
WriteResponseFile(oOutputDirectory, oResponseBody, $"{pTemplate.Name}-{pBaseFileName}-Response.xml")
|
||||
|
||||
Dim oBytes As Byte() = Encoding.UTF8.GetBytes(oResponseBody)
|
||||
@ -146,8 +157,8 @@ Namespace Winline
|
||||
For Each oDetails As Templates.Entities.MESOWebServiceResultResultDetails In oResponseObject.ResultDetails
|
||||
|
||||
If oDetails.Success = True Then
|
||||
Logger.Info("KeyValue: [{0}]", oDetails.KeyValue)
|
||||
Logger.Info("VoucherNumber: [{0}]", oDetails.VoucherNumber)
|
||||
Logger.Debug("KeyValue: [{0}]", oDetails.KeyValue)
|
||||
Logger.Debug("VoucherNumber: [{0}]", oDetails.VoucherNumber)
|
||||
Else
|
||||
Logger.Warn("ErrorCode: [{0}]", oDetails.ErrorCode)
|
||||
Logger.Warn("ErrorText: [{0}]", oDetails.ErrorText)
|
||||
@ -159,17 +170,23 @@ Namespace Winline
|
||||
If oResponseObject.OverallSuccess = False Then
|
||||
Dim oMessage = $"Request to Webservice was unsuccessful:{vbNewLine}{vbNewLine}{String.Join(vbNewLine, oErrorStrings.ToArray)}"
|
||||
|
||||
Logger.Warn("Overall Success was [false]")
|
||||
|
||||
Throw New WebServiceException(oMessage)
|
||||
End If
|
||||
End Using
|
||||
|
||||
Case "text/html"
|
||||
Logger.Debug("Got TEXT/HTML Response. Throwing.")
|
||||
WriteResponseFile(oOutputDirectory, oResponseBody, $"{pTemplate.Name}-{pBaseFileName}-Response.xml")
|
||||
|
||||
Throw New WebServiceException(oResponseBody)
|
||||
|
||||
Case Else
|
||||
Logger.Debug("Unknown Response ContentType: [{0}]", oContentType)
|
||||
|
||||
Throw New WebServiceException(oResponseBody)
|
||||
|
||||
End Select
|
||||
End Function
|
||||
|
||||
@ -216,7 +233,7 @@ Namespace Winline
|
||||
#End Region
|
||||
|
||||
#Region "Export"
|
||||
Async Function ExportDocumentFromWinline(pDocument As Entities.ExportDocument, pTemplate As Template, pMandator As Mandator, Optional pIsTest As Boolean = False) As Task(Of Boolean)
|
||||
Async Function ExportDocumentFromWinline(pDocument As ExportDocument, pTemplate As Template, pMandator As Mandator, Optional pIsTest As Boolean = False) As Task(Of Boolean)
|
||||
Dim oWS = Config
|
||||
|
||||
Logger.Info("Exporting document from Winline")
|
||||
|
||||
@ -39,6 +39,7 @@ Public Class FormHelper
|
||||
MsgBox(oMessage, MsgBoxStyle.Exclamation, Form.Text)
|
||||
End Sub
|
||||
|
||||
|
||||
Public Sub TryOpenDirectory(pPath As String, pDisplayName As String)
|
||||
If IO.Directory.Exists(pPath) Then
|
||||
Process.Start(pPath)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user