You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by bo...@apache.org on 2013/11/23 16:11:20 UTC
svn commit: r1544813 -
/logging/log4net/trunk/src/extensions/log4net.Ext.MarshalByRef/MarshalByRefLogImpl.cs
Author: bodewig
Date: Sat Nov 23 15:11:19 2013
New Revision: 1544813
URL: http://svn.apache.org/r1544813
Log:
adapt MarsahlByRef extension to include Trace methods
Modified:
logging/log4net/trunk/src/extensions/log4net.Ext.MarshalByRef/MarshalByRefLogImpl.cs
Modified: logging/log4net/trunk/src/extensions/log4net.Ext.MarshalByRef/MarshalByRefLogImpl.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/extensions/log4net.Ext.MarshalByRef/MarshalByRefLogImpl.cs?rev=1544813&r1=1544812&r2=1544813&view=diff
==============================================================================
--- logging/log4net/trunk/src/extensions/log4net.Ext.MarshalByRef/MarshalByRefLogImpl.cs (original)
+++ logging/log4net/trunk/src/extensions/log4net.Ext.MarshalByRef/MarshalByRefLogImpl.cs Sat Nov 23 15:11:19 2013
@@ -39,6 +39,7 @@ namespace log4net.Ext.MarshalByRef
{
private readonly static Type ThisDeclaringType = typeof(MarshalByRefLogImpl);
private readonly ILogger m_logger;
+ private Level m_levelTrace;
private Level m_levelDebug;
private Level m_levelInfo;
private Level m_levelWarn;
@@ -64,6 +65,7 @@ namespace log4net.Ext.MarshalByRef
{
LevelMap levelMap = repository.LevelMap;
+ m_levelTrace = levelMap.LookupWithDefault(Level.Trace);
m_levelDebug = levelMap.LookupWithDefault(Level.Debug);
m_levelInfo = levelMap.LookupWithDefault(Level.Info);
m_levelWarn = levelMap.LookupWithDefault(Level.Warn);
@@ -82,6 +84,56 @@ namespace log4net.Ext.MarshalByRef
#region Implementation of ILog
+ public void Trace(object message)
+ {
+ Logger.Log(ThisDeclaringType, m_levelTrace, message, null);
+ }
+
+ public void Trace(object message, Exception t)
+ {
+ Logger.Log(ThisDeclaringType, m_levelTrace, message, t);
+ }
+
+ public void TraceFormat(string format, params object[] args)
+ {
+ if (IsTraceEnabled)
+ {
+ Logger.Log(ThisDeclaringType, m_levelTrace, new SystemStringFormat(CultureInfo.InvariantCulture, format, args), null);
+ }
+ }
+
+ public void TraceFormat(string format, object arg0)
+ {
+ if (IsTraceEnabled)
+ {
+ Logger.Log(ThisDeclaringType, m_levelTrace, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0 }), null);
+ }
+ }
+
+ public void TraceFormat(string format, object arg0, object arg1)
+ {
+ if (IsTraceEnabled)
+ {
+ Logger.Log(ThisDeclaringType, m_levelTrace, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0, arg1 }), null);
+ }
+ }
+
+ public void TraceFormat(string format, object arg0, object arg1, object arg2)
+ {
+ if (IsTraceEnabled)
+ {
+ Logger.Log(ThisDeclaringType, m_levelTrace, new SystemStringFormat(CultureInfo.InvariantCulture, format, new object[] { arg0, arg1, arg2 }), null);
+ }
+ }
+
+ public void TraceFormat(IFormatProvider provider, string format, params object[] args)
+ {
+ if (IsTraceEnabled)
+ {
+ Logger.Log(ThisDeclaringType, m_levelTrace, new SystemStringFormat(provider, format, args), null);
+ }
+ }
+
public void Debug(object message)
{
Logger.Log(ThisDeclaringType, m_levelDebug, message, null);
@@ -332,6 +384,11 @@ namespace log4net.Ext.MarshalByRef
}
}
+ public bool IsTraceEnabled
+ {
+ get { return Logger.IsEnabledFor(m_levelTrace); }
+ }
+
public bool IsDebugEnabled
{
get { return Logger.IsEnabledFor(m_levelDebug); }