Commit afd464c0 authored by alan.f's avatar alan.f

add-nlog

parent 0d9a6b04
......@@ -38,17 +38,25 @@
<Reference Include="Dicom.Core, Version=4.0.4.0, Culture=neutral, PublicKeyToken=3a13f649e28eb09a, processorArchitecture=MSIL">
<HintPath>..\packages\fo-dicom.Desktop.4.0.4\lib\net45\Dicom.Core.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Reactive, Version=4.4.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reactive.4.4.1\lib\net46\System.Reactive.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
......@@ -86,6 +94,12 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Content Include="NLog.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="NLog.xsd">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
......
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
<!-- optional, add some variables
https://github.com/nlog/NLog/wiki/Configuration-file#variables
-->
<variable name="myvar" value="myvalue"/>
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets>
<target name ="f1" xsi:type="File" fileName="d:\Logs\NlogTestServiceLog.txt"/>
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="f1" />
<!-- add your logging rules here -->
<!--
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
<logger name="*" minlevel="Debug" writeTo="f" />
-->
</rules>
</nlog>
This source diff could not be displayed because it is too large. You can view the blob instead.
using Dicom.Network;
using NLog;
using System;
using System.Collections.Generic;
using System.IO;
......@@ -12,8 +13,11 @@ using DicomClient = Dicom.Network.Client.DicomClient;
namespace C_UI
{
public static class SCU_Store
{
static Logger logger = LogManager.GetCurrentClassLogger();
public static async Task StoreFile(string _storeServerHost, int _storeServerPort, string[] dicomFiles, string _aet, string _storeServerAET)
{
var client = new DicomClient(_storeServerHost, _storeServerPort, false, _storeServerAET, _aet);
......@@ -24,14 +28,14 @@ namespace C_UI
try
{
var request = new DicomCStoreRequest(currentFile.ToString());
request.OnResponseReceived += (req, response) => Console.WriteLine("C-Store Response Received, Status: " + response.Status);
request.OnResponseReceived += (req, response) => logger.Info(response.Status);
await client.AddRequestAsync(request);
await client.SendAsync();
}
catch (Exception exception)
{
MessageBox.Show(exception.Message);
logger.Error(exception.Message);
}
});
......
......@@ -2,6 +2,9 @@
<packages>
<package id="fo-dicom" version="4.0.4" targetFramework="net472" />
<package id="fo-dicom.Desktop" version="4.0.4" targetFramework="net472" />
<package id="NLog" version="4.7.0" targetFramework="net472" />
<package id="NLog.Config" version="4.7.0" targetFramework="net472" />
<package id="NLog.Schema" version="4.7.0" targetFramework="net472" />
<package id="System.Reactive" version="4.4.1" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment