Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ninject/ninject.extensions.logging
Browse files Browse the repository at this point in the history
Conflicts:
	Ninject.Extensions.Logging.NLog.build
	tools/nuget/NuGet.exe
  • Loading branch information
remogloor committed Jul 1, 2013
2 parents 6a004fc + 0376bff commit a740c3f
Show file tree
Hide file tree
Showing 18 changed files with 567 additions and 44 deletions.
25 changes: 17 additions & 8 deletions Ninject.Extensions.Logging.NLog2.build
Expand Up @@ -86,16 +86,23 @@
<exec
program="${path.tools.xunit.console}"
workingdir="${current.path.test.NLog2}"
commandline="${product.assembly.test.NLog2} /html ${current.path.test.NLog2}/results.html"
failonerror="true"
if="${not(string::contains(build.platform, 'mono')) or teamcity}"/>
if="${not(string::contains(build.platform, 'mono')) or teamcity}">
<arg value="${product.assembly.test.NLog2}" />
<arg value="/html" />
<arg path="${current.path.test.NLog2}/results.html" />
</exec>

<if test="${string::contains(build.platform, 'mono') and not(teamcity)}">
<exec
program="${framework::get-runtime-engine(framework::get-target-framework())}"
workingdir="${current.path.test.NLog2}"
commandline="${path.tools.xunit.console} ${product.assembly.test.NLog2} /html ${current.path.test.NLog2}/results.html"
failonerror="true"/>
failonerror="true">
<arg valuu="${path.tools.xunit.console}" />
<arg value="${product.assembly.test.NLog2}" />
<arg value="/html" />
<arg path="${current.path.test.NLog2}/results.html" />
</exec>
</if>
</target>

Expand Down Expand Up @@ -176,10 +183,12 @@
</target>

<target name="silverlight-test-NLog2" depends="compile-silverlight-tests-NLog2" unless="${skip.tests or skip.silverlightTests}" if="${string::contains(build.platform, 'silverlight')}">
<property name="cmdLine" value='-x"${product.assembly.silverlighttest.NLog2}" --teamcity --debug' if="${teamcity}"/>
<property name="cmdLine" value='-x"${product.assembly.silverlighttest.NLog2}"' unless="${teamcity}"/>
<exec program="${path.tools.statlight}" workingdir="${current.path.test.NLog2}" commandline="${cmdLine}" failonerror="true" unless="${string::contains(build.platform, 'wp')}" />
<exec program="${path.tools.statlight}" workingdir="${current.path.test.NLog2}" commandline="${cmdLine} --UsePhoneEmulator" failonerror="true" if="${string::contains(build.platform, 'wp')}" />
<if test="${not(skip.silverlightWPTests) or not(string::contains(build.platform, 'wp'))}">
<property name="cmdLine" value='-x"${product.assembly.silverlighttest.NLog2}" --teamcity --debug' if="${teamcity}"/>
<property name="cmdLine" value='-x"${product.assembly.silverlighttest.NLog2}"' unless="${teamcity}"/>
<exec program="${path.tools.statlight}" workingdir="${current.path.test.NLog2}" commandline="${cmdLine}" failonerror="true" unless="${string::contains(build.platform, 'wp')}" />
<exec program="${path.tools.statlight}" workingdir="${current.path.test.NLog2}" commandline="${cmdLine} --UsePhoneEmulator" failonerror="true" if="${string::contains(build.platform, 'wp')}" />
</if>
</target>

<target name="nuget-nlog2">
Expand Down
15 changes: 11 additions & 4 deletions Ninject.Extensions.Logging.log4net.build
Expand Up @@ -100,16 +100,23 @@
<exec
program="${path.tools.xunit.console}"
workingdir="${current.path.test.log4net}"
commandline="${product.assembly.test.log4net} /html ${current.path.test.log4net}/results.html"
failonerror="true"
if="${not(string::contains(build.platform, 'mono')) or teamcity}"/>
if="${not(string::contains(build.platform, 'mono')) or teamcity}">
<arg value="${product.assembly.test.log4net}" />
<arg value="/html" />
<arg path="${current.path.test.log4net}/results.html" />
</exec>

<if test="${string::contains(build.platform, 'mono') and not(teamcity)}">
<exec
program="${framework::get-runtime-engine(framework::get-target-framework())}"
workingdir="${current.path.test.log4net}"
commandline="${path.tools.xunit.console} ${product.assembly.test.log4net} /html ${current.path.test.log4net}/results.html"
failonerror="true"/>
failonerror="true">
<arg value="${path.tools.xunit.console}" />
<arg value="${product.assembly.test.log4net}" />
<arg value="/html" />
<arg path="${current.path.test.log4net}/results.html" />
</exec>
</if>
</target>

Expand Down
Expand Up @@ -12,8 +12,6 @@
namespace Ninject.Extensions.Logging.Log4net.Infrastructure
{
using System;
using System.Diagnostics;
using System.Globalization;
using log4net;
using log4net.Core;

Expand All @@ -31,12 +29,32 @@ public class Log4NetLogger : LoggerBase
/// Initializes a new instance of the <see cref="Log4NetLogger"/> class.
/// </summary>
/// <param name="type">The type to create a logger for.</param>
public Log4NetLogger(Type type)
: base(type)
public Log4NetLogger(Type type) : base(type)
{
this.log4NetLogger = LogManager.GetLogger(type);
}

/// <summary>
/// Initializes a new instance of the <see cref="Log4NetLogger"/> class.
/// </summary>
/// <param name="name">A custom name to use for the logger. If null, the type's FullName will be used.</param>
public Log4NetLogger(string name) : base(name)
{
this.log4NetLogger = LogManager.GetLogger(name);
}

/// <summary>
/// Gets the name of the logger.
/// </summary>
/// <value>The name of the logger.</value>
public override string Name
{
get
{
return this.log4NetLogger.Logger.Name;
}
}

/// <summary>
/// Gets a value indicating whether messages with Debug severity should be logged.
/// </summary>
Expand Down Expand Up @@ -94,7 +112,7 @@ public override bool IsFatalEnabled
/// <param name="message">The message.</param>
public override void Debug(string message)
{
this.log4NetLogger.DebugFormat("{0}", message);
this.log4NetLogger.Debug(message);
}

/// <summary>
Expand All @@ -118,13 +136,23 @@ public override void Debug(Exception exception, string format, params object[] a
this.log4NetLogger.Debug(String.Format(format, args), exception);
}

/// <summary>
/// Logs the specified exception with Debug severity.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="exception">The exception to log.</param>
public override void DebugException(string message, Exception exception)
{
this.log4NetLogger.Debug(message, exception);
}

/// <summary>
/// Logs the specified message with Info severity.
/// </summary>
/// <param name="message">The message.</param>
public override void Info(string message)
{
this.log4NetLogger.InfoFormat("{0}", message);
this.log4NetLogger.Info(message);
}

/// <summary>
Expand All @@ -148,13 +176,23 @@ public override void Info(Exception exception, string format, params object[] ar
this.log4NetLogger.Info(String.Format(format, args), exception);
}

/// <summary>
/// Logs the specified exception with Info severity.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="exception">The exception to log.</param>
public override void InfoException(string message, Exception exception)
{
this.log4NetLogger.Info(message, exception);
}

/// <summary>
/// Logs the specified message with Trace severity.
/// </summary>
/// <param name="message">The message.</param>
public override void Trace(string message)
{
this.log4NetLogger.Logger.Log(Type, Level.Trace, String.Format("{0}", message), null);
this.log4NetLogger.Logger.Log(Type, Level.Trace, message, null);
}

/// <summary>
Expand All @@ -178,13 +216,23 @@ public override void Trace(Exception exception, string format, params object[] a
this.log4NetLogger.Logger.Log(Type, Level.Trace, String.Format(format, args), exception);
}

/// <summary>
/// Logs the specified exception with Trace severity.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="exception">The exception to log.</param>
public override void TraceException(string message, Exception exception)
{
this.log4NetLogger.Logger.Log(Type, Level.Trace, message, exception);
}

/// <summary>
/// Logs the specified message with Warn severity.
/// </summary>
/// <param name="message">The message.</param>
public override void Warn(string message)
{
this.log4NetLogger.WarnFormat("{0}", message);
this.log4NetLogger.Warn(message);
}

/// <summary>
Expand All @@ -208,13 +256,23 @@ public override void Warn(Exception exception, string format, params object[] ar
this.log4NetLogger.Warn(String.Format(format, args), exception);
}

/// <summary>
/// Logs the specified message with Warn severity.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="exception">The exception to log.</param>
public override void WarnException(string message, Exception exception)
{
this.log4NetLogger.Warn(message, exception);
}

/// <summary>
/// Logs the specified message with Error severity.
/// </summary>
/// <param name="message">The message.</param>
public override void Error(string message)
{
this.log4NetLogger.ErrorFormat("{0}", message);
this.log4NetLogger.Error(message);
}

/// <summary>
Expand All @@ -238,13 +296,23 @@ public override void Error(Exception exception, string format, params object[] a
this.log4NetLogger.Error(String.Format(format, args), exception);
}

/// <summary>
/// Logs the specified exception with Error severity.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="exception">The exception to log.</param>
public override void ErrorException(string message, Exception exception)
{
this.log4NetLogger.Error(message, exception);
}

/// <summary>
/// Logs the specified message with Fatal severity.
/// </summary>
/// <param name="message">The message.</param>
public override void Fatal(string message)
{
this.log4NetLogger.FatalFormat("{0}", message);
this.log4NetLogger.Fatal(message);
}

/// <summary>
Expand All @@ -267,5 +335,15 @@ public override void Fatal(Exception exception, string format, params object[] a
{
this.log4NetLogger.Fatal(String.Format(format, args), exception);
}

/// <summary>
/// Logs the specified exception with Fatal severity.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="exception">The exception to log.</param>
public override void FatalException(string message, Exception exception)
{
this.log4NetLogger.Fatal(message, exception);
}
}
}
Expand Up @@ -27,5 +27,15 @@ protected override ILogger CreateLogger(Type type)
{
return new Log4NetLogger(type);
}

/// <summary>
/// Creates a logger with the specified name.
/// </summary>
/// <param name="name">The explicit name to create the logger for. If null, the type's FullName will be used.</param>
/// <returns>The newly-created logger.</returns>
protected override ILogger CreateLogger(string name)
{
return new Log4NetLogger(name);
}
}
}

0 comments on commit a740c3f

Please sign in to comment.