[Monodevelop-patches-list] r2731 - in trunk/MonoDevelop/Core/src/MonoDevelop.Base: . Services
Peter Johanson <latexer@gentoo.org>
pjohanson at mono-cvs.ximian.com
Wed Aug 10 09:22:12 EDT 2005
Author: pjohanson
Date: 2005-08-10 09:22:12 -0400 (Wed, 10 Aug 2005)
New Revision: 2731
Modified:
trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/DefaultLoggingService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ILoggingService.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ResourceService.cs
Log:
Add support for logging to arbitrarily named loggers.
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-08-10 12:54:07 UTC (rev 2730)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-08-10 13:22:12 UTC (rev 2731)
@@ -1,3 +1,11 @@
+2005-08-10 Peter Johanson <latexer at gentoo.org>
+
+ * Services/ILoggingService.cs:
+ * Services/DefaultLoggingService.cs: Add support for for logging to
+ arbitrarily named loggers. Allows for easy filtering/control of
+ logging.
+ * Services/ResourceService.cs: Report to logger named by service type.
+
2005-08-10 Ben Motmans <ben.motmans at gmail.com>
* MonoDevelop.Base.mdp: references update + missing/added files
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/DefaultLoggingService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/DefaultLoggingService.cs 2005-08-10 12:54:07 UTC (rev 2730)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/DefaultLoggingService.cs 2005-08-10 13:22:12 UTC (rev 2731)
@@ -32,9 +32,9 @@
return LogManager.GetLogger(typeof(ILoggingService));
}
- ILog GetLogger (System.Type type)
+ ILog GetLogger (string name)
{
- return LogManager.GetLogger(type);
+ return LogManager.GetLogger(name);
}
public bool IsDebugEnabled {
@@ -67,33 +67,33 @@
}
}
- public void Debug (System.Type type, object message)
+ public void Debug (string logger, object message)
{
- GetLogger(type).Debug (message);
+ GetLogger(logger).Debug (message);
OnLogAppended ("Debug", message.ToString());
}
- public void Info (System.Type type, object message)
+ public void Info (string logger, object message)
{
- GetLogger(type).Info (message);
+ GetLogger(logger).Info (message);
OnLogAppended ("Info", message.ToString());
}
- public void Warn (System.Type type, object message)
+ public void Warn (string logger, object message)
{
- GetLogger(type).Warn (message);
+ GetLogger(logger).Warn (message);
OnLogAppended ("Warn", message.ToString());
}
- public void Error (System.Type type, object message)
+ public void Error (string logger, object message)
{
- GetLogger(type).Error (message);
+ GetLogger(logger).Error (message);
OnLogAppended ("Error", message.ToString());
}
- public void Fatal (System.Type type, object message)
+ public void Fatal (string logger, object message)
{
- GetLogger(type).Fatal (message);
+ GetLogger(logger).Fatal (message);
OnLogAppended ("Fatal", message.ToString());
}
@@ -132,6 +132,12 @@
GetLogger().Debug (message, t);
OnLogAppended ("Debug", message + t.ToString());
}
+
+ public void Debug (string logger, object message, Exception t)
+ {
+ GetLogger(logger).Debug (message, t);
+ OnLogAppended ("Debug", message + t.ToString());
+ }
public void Info (object message, Exception t)
{
@@ -139,17 +145,35 @@
OnLogAppended ("Info", message + t.ToString());
}
+ public void Info (string logger, object message, Exception t)
+ {
+ GetLogger(logger).Info (message, t);
+ OnLogAppended ("Info", message + t.ToString());
+ }
+
public void Warn (object message, Exception t)
{
GetLogger().Warn (message, t);
OnLogAppended ("Warn", message + t.ToString());
}
+ public void Warn (string logger, object message, Exception t)
+ {
+ GetLogger(logger).Warn (message, t);
+ OnLogAppended ("Warn", message + t.ToString());
+ }
+
public void Error (object message, Exception t)
{
GetLogger().Error (message, t);
OnLogAppended ("Error", message + t.ToString());
}
+
+ public void Error (string logger, object message, Exception t)
+ {
+ GetLogger(logger).Error (message, t);
+ OnLogAppended ("Error", message + t.ToString());
+ }
public void Fatal (object message, Exception t)
{
@@ -157,6 +181,12 @@
OnLogAppended ("Fatal", message + t.ToString());
}
+ public void Fatal (string logger, object message, Exception t)
+ {
+ GetLogger(logger).Fatal (message, t);
+ OnLogAppended ("Fatal", message + t.ToString());
+ }
+
public void DebugFormat (string format, params object[] args)
{
GetLogger().DebugFormat (format, args);
@@ -187,33 +217,33 @@
OnLogAppended ("Fatal", String.Format(format, args));
}
- public void DebugFormat (Type type, string format, params object[] args)
+ public void DebugFormat (string logger, string format, params object[] args)
{
- GetLogger(type).DebugFormat (format, args);
+ GetLogger(logger).DebugFormat (format, args);
OnLogAppended ("Debug", String.Format(format, args));
}
- public void InfoFormat (Type type, string format, params object[] args)
+ public void InfoFormat (string logger, string format, params object[] args)
{
- GetLogger(type).InfoFormat (format, args);
+ GetLogger(logger).InfoFormat (format, args);
OnLogAppended ("Info", String.Format(format, args));
}
- public void WarnFormat (Type type, string format, params object[] args)
+ public void WarnFormat (string logger, string format, params object[] args)
{
- GetLogger(type).WarnFormat (format, args);
+ GetLogger(logger).WarnFormat (format, args);
OnLogAppended ("Warn", String.Format(format, args));
}
- public void ErrorFormat (Type type, string format, params object[] args)
+ public void ErrorFormat (string logger, string format, params object[] args)
{
- GetLogger(type).ErrorFormat (format, args);
+ GetLogger(logger).ErrorFormat (format, args);
OnLogAppended ("Error", String.Format(format, args));
}
- public void FatalFormat (Type type, string format, params object[] args)
+ public void FatalFormat (string logger, string format, params object[] args)
{
- GetLogger(type).FatalFormat (format, args);
+ GetLogger(logger).FatalFormat (format, args);
OnLogAppended ("Fatal", String.Format(format, args));
}
@@ -223,17 +253,35 @@
OnLogAppended ("Debug", String.Format(provider, format, args));
}
+ public void DebugFormat(string logger, IFormatProvider provider, string format, params object[] args)
+ {
+ GetLogger(logger).DebugFormat (provider, format, args);
+ OnLogAppended ("Debug", String.Format(provider, format, args));
+ }
+
public void InfoFormat(IFormatProvider provider, string format, params object[] args)
{
GetLogger().InfoFormat (provider, format, args);
OnLogAppended ("Info", String.Format(provider, format, args));
}
+ public void InfoFormat(string logger, IFormatProvider provider, string format, params object[] args)
+ {
+ GetLogger(logger).InfoFormat (provider, format, args);
+ OnLogAppended ("Info", String.Format(provider, format, args));
+ }
+
public void WarnFormat(IFormatProvider provider, string format, params object[] args)
{
GetLogger().WarnFormat (provider, format, args);
OnLogAppended ("Warn", String.Format(provider, format, args));
}
+
+ public void WarnFormat(string logger, IFormatProvider provider, string format, params object[] args)
+ {
+ GetLogger(logger).WarnFormat (provider, format, args);
+ OnLogAppended ("Warn", String.Format(provider, format, args));
+ }
public void ErrorFormat(IFormatProvider provider, string format, params object[] args)
{
@@ -241,12 +289,24 @@
OnLogAppended ("Error", String.Format(provider, format, args));
}
+ public void ErrorFormat(string logger, IFormatProvider provider, string format, params object[] args)
+ {
+ GetLogger(logger).ErrorFormat (provider, format, args);
+ OnLogAppended ("Error", String.Format(provider, format, args));
+ }
+
public void FatalFormat(IFormatProvider provider, string format, params object[] args)
{
GetLogger().FatalFormat (provider, format, args);
OnLogAppended ("Fatal", String.Format(provider, format, args));
}
+ public void FatalFormat(string logger, IFormatProvider provider, string format, params object[] args)
+ {
+ GetLogger(logger).FatalFormat (provider, format, args);
+ OnLogAppended ("Fatal", String.Format(provider, format, args));
+ }
+
public void OnLogAppended(string level, string message)
{
if (LogAppended != null) {
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ILoggingService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ILoggingService.cs 2005-08-10 12:54:07 UTC (rev 2730)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ILoggingService.cs 2005-08-10 13:22:12 UTC (rev 2731)
@@ -20,6 +20,12 @@
void Warn(object message);
void Error(object message);
void Fatal(object message);
+
+ void Debug(string logger, object message);
+ void Info(string logger, object message);
+ void Warn(string logger, object message);
+ void Error(string logger, object message);
+ void Fatal(string logger, object message);
/* Log a message object and exception */
void Debug(object message, Exception t);
@@ -28,6 +34,12 @@
void Error(object message, Exception t);
void Fatal(object message, Exception t);
+ void Debug(string logger, object message, Exception t);
+ void Info(string logger, object message, Exception t);
+ void Warn(string logger, object message, Exception t);
+ void Error(string logger, object message, Exception t);
+ void Fatal(string logger, object message, Exception t);
+
/* Log a message string using the System.String.Format syntax */
void DebugFormat(string format, params object[] args);
void InfoFormat(string format, params object[] args);
@@ -35,6 +47,12 @@
void ErrorFormat(string format, params object[] args);
void FatalFormat(string format, params object[] args);
+ void DebugFormat(string logger, string format, params object[] args);
+ void InfoFormat(string logger, string format, params object[] args);
+ void WarnFormat(string logger, string format, params object[] args);
+ void ErrorFormat(string logger, string format, params object[] args);
+ void FatalFormat(string logger, string format, params object[] args);
+
/* Log a message string using the System.String.Format syntax */
void DebugFormat(IFormatProvider provider, string format, params object[] args);
void InfoFormat(IFormatProvider provider, string format, params object[] args);
@@ -42,6 +60,12 @@
void ErrorFormat(IFormatProvider provider, string format, params object[] args);
void FatalFormat(IFormatProvider provider, string format, params object[] args);
+ void DebugFormat(string logger, IFormatProvider provider, string format, params object[] args);
+ void InfoFormat(string logger, IFormatProvider provider, string format, params object[] args);
+ void WarnFormat(string logger, IFormatProvider provider, string format, params object[] args);
+ void ErrorFormat(string logger, IFormatProvider provider, string format, params object[] args);
+ void FatalFormat(string logger, IFormatProvider provider, string format, params object[] args);
+
event LogAppendedHandler LogAppended;
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ResourceService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ResourceService.cs 2005-08-10 12:54:07 UTC (rev 2730)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ResourceService.cs 2005-08-10 13:22:12 UTC (rev 2731)
@@ -213,7 +213,7 @@
catch (GLib.GException ex) {
// just discard the exception, the icon simply can't be
// loaded
- Runtime.LoggingService.InfoFormat("Warning: can't load " + filename +
+ Runtime.LoggingService.Info(typeof(ResourceService).ToString(), "Warning: can't load " + filename +
" icon file");
}
}
@@ -235,7 +235,7 @@
if (s != null)
return s;
- Runtime.LoggingService.InfoFormat("WARNING Could not find stock {0}", filename);
+ Runtime.LoggingService.InfoFormat(typeof(ResourceService).ToString(), "WARNING Could not find stock {0}", filename);
return filename;
}
More information about the Monodevelop-patches-list
mailing list