Mercurial > repos > IBBoard
view Logging/LogNotifier.cs @ 16:0352fa33ee8f
Closes #8 - license code
* Add LGPL header to IBBoard utility library
* Add COPYING.LGPL and COPYING.GPL with details of license
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 25 Jan 2009 15:04:31 +0000 |
parents | 465b672e9682 |
children | fb4fdab841db |
line wrap: on
line source
// This file (LogNotifier.cs) is a part of the IBBoard library and is copyright 2009 IBBoard. // // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. using System; namespace IBBoard.Logging { public delegate void LogEventOccurredDelegate(Type logFromType, Object message, Exception e); public class LogNotifier { public static event LogEventOccurredDelegate DebugLogEventOccurred; public static event LogEventOccurredDelegate InfoLogEventOccurred; public static event LogEventOccurredDelegate WarningLogEventOccurred; public static event LogEventOccurredDelegate ErrorLogEventOccurred; public static event LogEventOccurredDelegate FatalLogEventOccurred; public static void DebugFormat(Type logFromType, String message, params object[] vals) { Debug(logFromType, String.Format(message, vals)); } public static void Debug(Type logFromType, Object message) { Debug(logFromType, message, null); } public static void Debug(Type logFromType, Object message, Exception e) { if (DebugLogEventOccurred!=null) { DebugLogEventOccurred(logFromType, message, e); } } public static void InfoFormat(Type logFromType, String message, params object[] vals) { Info(logFromType, String.Format(message, vals)); } public static void Info(Type logFromType, Object message) { Info(logFromType, message, null); } public static void Info(Type logFromType, Object message, Exception e) { if (InfoLogEventOccurred!=null) { InfoLogEventOccurred(logFromType, message, e); } } public static void WarnFormat(Type logFromType, String message, params object[] vals) { Warn(logFromType, String.Format(message, vals)); } public static void Warn(Type logFromType, Object message) { Warn(logFromType, message, null); } public static void Warn(Type logFromType, Object message, Exception e) { if (WarningLogEventOccurred!=null) { WarningLogEventOccurred(logFromType, message, e); } } public static void ErrorFormat(Type logFromType, String message, params object[] vals) { Error(logFromType, String.Format(message, vals)); } public static void Error(Type logFromType, Object message) { Error(logFromType, message, null); } public static void Error(Type logFromType, Object message, Exception e) { if (ErrorLogEventOccurred!=null) { ErrorLogEventOccurred(logFromType, message, e); } } public static void FatalFormat(Type logFromType, String message, params object[] vals) { Fatal(logFromType, String.Format(message, vals)); } public static void Fatal(Type logFromType, Object message) { Fatal(logFromType, message, null); } public static void Fatal(Type logFromType, Object message, Exception e) { if (FatalLogEventOccurred!=null) { FatalLogEventOccurred(logFromType, message, e); } } } }