Skip to content

Commit a44ab02

Browse files
committed
Fix ref to ServiceStack.Interfaces.dll and add NLog provider
1 parent ee2254f commit a44ab02

10 files changed

Lines changed: 358 additions & 42 deletions

File tree

lib/NLog.dll

297 KB
Binary file not shown.

lib/ServiceStack.Interfaces.dll

66 KB
Binary file not shown.

src/ServiceStack.Logging.EventLog/ServiceStack.Logging.EventLog.csproj

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
33
<PropertyGroup>
44
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -39,7 +39,6 @@
3939
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
4040
<UseApplicationTrust>false</UseApplicationTrust>
4141
<BootstrapperEnabled>true</BootstrapperEnabled>
42-
<TargetFrameworkProfile />
4342
</PropertyGroup>
4443
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
4544
<DebugSymbols>true</DebugSymbols>
@@ -61,13 +60,13 @@
6160
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
6261
</PropertyGroup>
6362
<ItemGroup>
64-
<Reference Include="ServiceStack.Interfaces, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
65-
<SpecificVersion>False</SpecificVersion>
66-
<HintPath>..\..\lib\ServiceStack.Interfaces.dll</HintPath>
67-
</Reference>
6863
<Reference Include="System" />
6964
<Reference Include="System.Data" />
7065
<Reference Include="System.Xml" />
66+
<Reference Include="ServiceStack.Interfaces, Version=1.0.4132.8321, Culture=neutral, PublicKeyToken=null">
67+
<SpecificVersion>False</SpecificVersion>
68+
<HintPath>..\..\lib\ServiceStack.Interfaces.dll</HintPath>
69+
</Reference>
7170
</ItemGroup>
7271
<ItemGroup>
7372
<Compile Include="EventLogFactory.cs" />

src/ServiceStack.Logging.Log4Net/ServiceStack.Logging.Log4Net.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
33
<PropertyGroup>
44
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -39,7 +39,6 @@
3939
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
4040
<UseApplicationTrust>false</UseApplicationTrust>
4141
<BootstrapperEnabled>true</BootstrapperEnabled>
42-
<TargetFrameworkProfile />
4342
</PropertyGroup>
4443
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
4544
<DebugSymbols>true</DebugSymbols>
@@ -61,16 +60,17 @@
6160
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
6261
</PropertyGroup>
6362
<ItemGroup>
64-
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
63+
<Reference Include="System" />
64+
<Reference Include="System.Data" />
65+
<Reference Include="System.Xml" />
66+
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821">
6567
<SpecificVersion>False</SpecificVersion>
6668
<HintPath>..\..\lib\log4net.dll</HintPath>
6769
</Reference>
68-
<Reference Include="ServiceStack.Interfaces">
70+
<Reference Include="ServiceStack.Interfaces, Version=1.0.4132.8321, Culture=neutral, PublicKeyToken=null">
71+
<SpecificVersion>False</SpecificVersion>
6972
<HintPath>..\..\lib\ServiceStack.Interfaces.dll</HintPath>
7073
</Reference>
71-
<Reference Include="System" />
72-
<Reference Include="System.Data" />
73-
<Reference Include="System.Xml" />
7474
</ItemGroup>
7575
<ItemGroup>
7676
<Compile Include="Log4NetFactory.cs" />

src/ServiceStack.Logging.Log4Netv129/ServiceStack.Logging.Log4Netv129.csproj

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
33
<PropertyGroup>
44
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -39,7 +39,6 @@
3939
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
4040
<UseApplicationTrust>false</UseApplicationTrust>
4141
<BootstrapperEnabled>true</BootstrapperEnabled>
42-
<TargetFrameworkProfile />
4342
</PropertyGroup>
4443
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
4544
<DebugSymbols>true</DebugSymbols>
@@ -61,17 +60,17 @@
6160
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
6261
</PropertyGroup>
6362
<ItemGroup>
64-
<Reference Include="log4net.1.2.9, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905">
63+
<Reference Include="System" />
64+
<Reference Include="System.Data" />
65+
<Reference Include="System.Xml" />
66+
<Reference Include="log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905">
6567
<SpecificVersion>False</SpecificVersion>
6668
<HintPath>..\..\lib\log4net.1.2.9.dll</HintPath>
6769
</Reference>
68-
<Reference Include="ServiceStack.Interfaces, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
70+
<Reference Include="ServiceStack.Interfaces, Version=1.0.4132.8321, Culture=neutral, PublicKeyToken=null">
6971
<SpecificVersion>False</SpecificVersion>
7072
<HintPath>..\..\lib\ServiceStack.Interfaces.dll</HintPath>
7173
</Reference>
72-
<Reference Include="System" />
73-
<Reference Include="System.Data" />
74-
<Reference Include="System.Xml" />
7574
</ItemGroup>
7675
<ItemGroup>
7776
<Compile Include="Log4NetFactory.cs" />
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System;
2+
using ServiceStack.Logging;
3+
4+
namespace ServiceStack.Logging.NLogger
5+
{
6+
/// <summary>
7+
/// ILogFactory that creates an NLog ILog logger
8+
/// </summary>
9+
public class NLogFactory : ServiceStack.Logging.ILogFactory
10+
{
11+
/// <summary>
12+
/// Initializes a new instance of the <see cref="NLogFactory"/> class.
13+
/// </summary>
14+
public NLogFactory() { }
15+
16+
/// <summary>
17+
/// Gets the logger.
18+
/// </summary>
19+
/// <param name="type">The type.</param>
20+
/// <returns></returns>
21+
public ILog GetLogger(Type type)
22+
{
23+
return new NLogLogger(type);
24+
}
25+
26+
/// <summary>
27+
/// Gets the logger.
28+
/// </summary>
29+
/// <param name="typeName">Name of the type.</param>
30+
/// <returns></returns>
31+
public ILog GetLogger(string typeName)
32+
{
33+
return new NLogLogger(typeName);
34+
}
35+
}
36+
}
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
using System;
2+
using ServiceStack.Logging;
3+
4+
namespace ServiceStack.Logging.NLogger
5+
{
6+
/// <summary>
7+
/// Wrapper over the NLog 2.0 beta and above logger
8+
/// </summary>
9+
public class NLogLogger : ServiceStack.Logging.ILog
10+
{
11+
private readonly NLog.Logger log;
12+
13+
public NLogLogger(string typeName)
14+
{
15+
log = NLog.LogManager.GetLogger(typeName);
16+
}
17+
18+
/// <summary>
19+
/// Initializes a new instance of the <see cref="NLogLogger"/> class.
20+
/// </summary>
21+
/// <param name="type">The type.</param>
22+
public NLogLogger(Type type)
23+
{
24+
log = NLog.LogManager.GetLogger(type.Name);
25+
}
26+
27+
public bool IsDebugEnabled { get { return log.IsDebugEnabled; } }
28+
29+
/// <summary>
30+
/// Logs a Debug message.
31+
/// </summary>
32+
/// <param name="message">The message.</param>
33+
public void Debug(object message)
34+
{
35+
log.Debug(message);
36+
}
37+
38+
/// <summary>
39+
/// Logs a Debug message and exception.
40+
/// </summary>
41+
/// <param name="message">The message.</param>
42+
/// <param name="exception">The exception.</param>
43+
public void Debug(object message, Exception exception)
44+
{
45+
log.Debug(message + " : " + exception.ToString());
46+
}
47+
48+
/// <summary>
49+
/// Logs a Debug format message.
50+
/// </summary>
51+
/// <param name="format">The format.</param>
52+
/// <param name="args">The args.</param>
53+
public void DebugFormat(string format, params object[] args)
54+
{
55+
log.Debug(format, args);
56+
}
57+
58+
/// <summary>
59+
/// Logs a Error message.
60+
/// </summary>
61+
/// <param name="message">The message.</param>
62+
public void Error(object message)
63+
{
64+
log.Error(message);
65+
}
66+
67+
/// <summary>
68+
/// Logs a Error message and exception.
69+
/// </summary>
70+
/// <param name="message">The message.</param>
71+
/// <param name="exception">The exception.</param>
72+
public void Error(object message, Exception exception)
73+
{
74+
log.Error(message + " : " + exception.ToString());
75+
}
76+
77+
/// <summary>
78+
/// Logs a Error format message.
79+
/// </summary>
80+
/// <param name="format">The format.</param>
81+
/// <param name="args">The args.</param>
82+
public void ErrorFormat(string format, params object[] args)
83+
{
84+
log.Error(format, args);
85+
}
86+
87+
/// <summary>
88+
/// Logs a Fatal message.
89+
/// </summary>
90+
/// <param name="message">The message.</param>
91+
public void Fatal(object message)
92+
{
93+
log.Fatal(message);
94+
}
95+
96+
/// <summary>
97+
/// Logs a Fatal message and exception.
98+
/// </summary>
99+
/// <param name="message">The message.</param>
100+
/// <param name="exception">The exception.</param>
101+
public void Fatal(object message, Exception exception)
102+
{
103+
log.Fatal(message + " : " + exception.ToString());
104+
}
105+
106+
/// <summary>
107+
/// Logs a Error format message.
108+
/// </summary>
109+
/// <param name="format">The format.</param>
110+
/// <param name="args">The args.</param>
111+
public void FatalFormat(string format, params object[] args)
112+
{
113+
log.Fatal(format, args);
114+
}
115+
116+
/// <summary>
117+
/// Logs an Info message and exception.
118+
/// </summary>
119+
/// <param name="message">The message.</param>
120+
public void Info(object message)
121+
{
122+
log.Info(message);
123+
}
124+
125+
/// <summary>
126+
/// Logs an Info message and exception.
127+
/// </summary>
128+
/// <param name="message">The message.</param>
129+
/// <param name="exception">The exception.</param>
130+
public void Info(object message, Exception exception)
131+
{
132+
log.Info(message + " : " + exception.ToString());
133+
}
134+
135+
/// <summary>
136+
/// Logs an Info format message.
137+
/// </summary>
138+
/// <param name="format">The format.</param>
139+
/// <param name="args">The args.</param>
140+
public void InfoFormat(string format, params object[] args)
141+
{
142+
log.Info(format, args);
143+
}
144+
145+
/// <summary>
146+
/// Logs a Warning message.
147+
/// </summary>
148+
/// <param name="message">The message.</param>
149+
public void Warn(object message)
150+
{
151+
log.Warn(message);
152+
}
153+
154+
/// <summary>
155+
/// Logs a Warning message and exception.
156+
/// </summary>
157+
/// <param name="message">The message.</param>
158+
/// <param name="exception">The exception.</param>
159+
public void Warn(object message, Exception exception)
160+
{
161+
log.Warn(message + " : " + exception.ToString());
162+
}
163+
164+
/// <summary>
165+
/// Logs a Warning format message.
166+
/// </summary>
167+
/// <param name="format">The format.</param>
168+
/// <param name="args">The args.</param>
169+
public void WarnFormat(string format, params object[] args)
170+
{
171+
log.Warn(format, args);
172+
}
173+
}
174+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("ServiceStack.Logging.NLog")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("Microsoft")]
12+
[assembly: AssemblyProduct("ServiceStack.Logging.NLog")]
13+
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("9c2fa048-ddf0-4626-aa54-173eec579d69")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)