forked from luigiberrettini/NLog.Targets.Syslog
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
290 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,3 +154,5 @@ $RECYCLE.BIN/ | |
|
||
# Mac desktop service store files | ||
.DS_Store | ||
src/.vs | ||
project.lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.25420.1 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{92015ECC-C6DD-4D66-8A36-6ADF2464984C}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EA7BE9F4-DF35-4AC1-B2B5-1E16A9B78349}" | ||
ProjectSection(SolutionItems) = preProject | ||
global.json = global.json | ||
EndProjectSection | ||
EndProject | ||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "NLog.Targets.Syslog.Dotnet", "NLog.Targets.Syslog.Dotnet\NLog.Targets.Syslog.Dotnet.xproj", "{F4B2393A-691E-4EC3-B4C4-C03AE4D32321}" | ||
EndProject | ||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "NLog.Targets.Syslog.Test.Dotnet", "NLog.Targets.Syslog.Test.Dotnet\NLog.Targets.Syslog.Test.Dotnet.xproj", "{A687BAD3-8198-4A15-8246-2D6148815B5F}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{F4B2393A-691E-4EC3-B4C4-C03AE4D32321}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{F4B2393A-691E-4EC3-B4C4-C03AE4D32321}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{F4B2393A-691E-4EC3-B4C4-C03AE4D32321}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{F4B2393A-691E-4EC3-B4C4-C03AE4D32321}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{A687BAD3-8198-4A15-8246-2D6148815B5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{A687BAD3-8198-4A15-8246-2D6148815B5F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{A687BAD3-8198-4A15-8246-2D6148815B5F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{A687BAD3-8198-4A15-8246-2D6148815B5F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
{F4B2393A-691E-4EC3-B4C4-C03AE4D32321} = {92015ECC-C6DD-4D66-8A36-6ADF2464984C} | ||
{A687BAD3-8198-4A15-8246-2D6148815B5F} = {92015ECC-C6DD-4D66-8A36-6ADF2464984C} | ||
EndGlobalSection | ||
EndGlobal |
21 changes: 21 additions & 0 deletions
21
src/NLog.Targets.Syslog.Dotnet/NLog.Targets.Syslog.Dotnet.xproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> | ||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> | ||
</PropertyGroup> | ||
|
||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" /> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>f4b2393a-691e-4ec3-b4c4-c03ae4d32321</ProjectGuid> | ||
<RootNamespace>NLog.Targets.Syslog.Dotnet</RootNamespace> | ||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath> | ||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath> | ||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
</PropertyGroup> | ||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"version": "2.2.0-*", | ||
"buildOptions": { | ||
"compile": { | ||
"include": [ "../NLog.Targets.Syslog/**/*.cs" ] | ||
}, | ||
"warningsAsErrors": false, | ||
"outputName": "NLog.Targets.Syslog", | ||
"xmlDoc": true | ||
}, | ||
"configurations": { | ||
"Debug": { | ||
"buildOptions": { | ||
"define": [ "DEBUG", "TRACE" ] | ||
} | ||
}, | ||
"Release": { | ||
"buildOptions": { | ||
"define": [ "TRACE" ], | ||
"optimize": true | ||
} | ||
} | ||
}, | ||
"frameworks": { | ||
"netstandard1.6": { | ||
"imports": "dnxcore5.0" | ||
|
||
} | ||
}, | ||
"dependencies": { | ||
"NETStandard.Library": "1.6.0", | ||
"NLog": "4.4.0-betaV15", | ||
"System.Net.Security": "4.0.0" | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/NLog.Targets.Syslog.Test.Dotnet/NLog.Targets.Syslog.Test.Dotnet.xproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion> | ||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> | ||
</PropertyGroup> | ||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" /> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>a687bad3-8198-4a15-8246-2d6148815b5f</ProjectGuid> | ||
<RootNamespace>NLog.Targets.Syslog.Test.Dotnet</RootNamespace> | ||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath> | ||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath> | ||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" /> | ||
</ItemGroup> | ||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- | ||
This file needs to be put in the application directory. Make sure to set | ||
'Copy to Output Directory' option in Visual Studio. | ||
--> | ||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
|
||
<extensions> | ||
<add assembly="NLog.Targets.Syslog" /> | ||
</extensions> | ||
|
||
<variable name="enterpriseId" value="12345"/> | ||
|
||
<targets> | ||
<target | ||
name="syslog" | ||
type="Syslog" | ||
syslogserver="127.0.0.1" | ||
port="514" | ||
facility="Local7" | ||
sender="MyProgram" | ||
layout="[CustomPrefix] ${machinename} ${message} ${callsite} ${exception:format=ToString,StackTrace}" /> | ||
|
||
<target type="AsyncWrapper" name="async"> | ||
<target | ||
name="syslog-new" | ||
type="Syslog" | ||
syslogserver="127.0.0.1" | ||
port="514" | ||
facility="Local7" | ||
rfc="Rfc5424" | ||
machineName="${machinename}" | ||
sender="${logger}" | ||
procid="${processid}" | ||
msgid="testmsgid" | ||
structureddata="[thread@${enterpriseId} id="${threadid}"]" | ||
layout="${message} ${exception:format=ToString,StackTrace}" /> | ||
</target> | ||
</targets> | ||
|
||
<rules> | ||
<!--<logger name="*" minLevel="Trace" appendTo="syslog"/>--> | ||
<!--<logger name="*" minLevel="Trace" appendTo="syslog-new"/>--> | ||
<logger name="*" minLevel="Trace" appendTo="async"/> | ||
</rules> | ||
|
||
</nlog> |
19 changes: 19 additions & 0 deletions
19
src/NLog.Targets.Syslog.Test.Dotnet/Properties/AssemblyInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("NLog.Targets.Syslog.Test.Dotnet")] | ||
[assembly: AssemblyTrademark("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("a687bad3-8198-4a15-8246-2d6148815b5f")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.Extensions.Logging; | ||
using NLog.Config; | ||
using Xunit; | ||
using NLog; | ||
using NLog.Extensions.Logging; | ||
|
||
namespace NLog.Targets.Syslog.Test.Dotnet | ||
{ | ||
public class TestLogger | ||
{ | ||
|
||
public TestLogger() | ||
{ | ||
|
||
} | ||
|
||
[Fact] | ||
public void TestLog() | ||
{ | ||
ILoggerFactory loggerFactory = new LoggerFactory(); | ||
loggerFactory.AddNLog(); | ||
var logger = loggerFactory.CreateLogger("TestLogger"); | ||
var config = new XmlLoggingConfiguration("Nlog.config"); | ||
LogManager.Configuration = config; | ||
Assert.True(config.AllTargets.Count>0); | ||
logger.LogTrace("This is a sample trace message"); | ||
logger.LogDebug("This is a sample debug message"); | ||
logger.LogInformation("This is a sample info message"); | ||
logger.LogWarning("This is a sample warn message"); | ||
logger.LogError("This is a sample error message"); | ||
logger.LogCritical("This is a sample fatal message"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"version": "1.0.0-*", | ||
|
||
"dependencies": { | ||
"Microsoft.NETCore.App": { | ||
"type": "platform", | ||
"version": "1.0.0" | ||
}, | ||
"Microsoft.Extensions.Logging.Abstractions": "1.0.0", | ||
"NETStandard.Library": "1.6.0", | ||
"NLog": "4.4.0-betaV15", | ||
"xunit": "2.2.0-beta2-build3300", | ||
"dotnet-test-xunit": "2.2.0-preview2-build1029", | ||
"Microsoft.Extensions.Logging": "1.0.0", | ||
"NLog.Extensions.Logging": "1.0.0-*", | ||
"NLog.Targets.Syslog.Dotnet": "2.2.0-*" | ||
}, | ||
|
||
"frameworks": { | ||
"netcoreapp1.0": { | ||
"imports": "dnxcore5.0" | ||
} | ||
}, | ||
"testRunner": "xunit" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"projects": [ "src", "test" ], | ||
"sdk": { | ||
"version": "1.0.0-preview2-003121" | ||
} | ||
} |