rename.2.tfsbot
[tfs.git] / tools / tfsbot / SmartIrc4net / Logger.cs
blobf7aef12b7f19115b4563005d2b14f2c7637394cd
1 /*
2 * $Id: Logger.cs 209 2006-12-22 19:11:35Z meebey $
3 * $URL: svn://svn.qnetp.net/smartirc/SmartIrc4net/tags/0.4.0/src/Logger.cs $
4 * $Rev: 209 $
5 * $Author: meebey $
6 * $Date: 2006-12-22 20:11:35 +0100 (Fri, 22 Dec 2006) $
8 * SmartIrc4net - the IRC library for .NET/C# <http://smartirc4net.sf.net>
10 * Copyright (c) 2003-2005 Mirco Bauer <meebey@meebey.net> <http://www.meebey.net>
12 * Full LGPL License: <http://www.gnu.org/licenses/lgpl.txt>
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 using System.IO;
30 using System.Collections;
32 namespace Meebey.SmartIrc4net
34 #if LOG4NET
35 /// <summary>
36 ///
37 /// </summary>
38 public enum LogCategory
40 Main,
41 Connection,
42 Socket,
43 Queue,
44 IrcMessages,
45 MessageTypes,
46 MessageParser,
47 ActionHandler,
48 TimeHandler,
49 MessageHandler,
50 ChannelSyncing,
51 UserSyncing,
52 Modules,
53 Dcc
56 /// <summary>
57 ///
58 /// </summary>
59 /// <threadsafety static="true" instance="true" />
60 internal class Logger
62 private static SortedList _LoggerList = new SortedList();
63 private static bool _Init;
65 private Logger()
69 public static void Init()
71 if (_Init) {
72 return;
75 _Init = true;
78 FileInfo fi = new FileInfo("SmartIrc4net_log.config");
79 if (fi.Exists) {
80 log4net.Config.DOMConfigurator.ConfigureAndWatch(fi);
81 } else {
82 log4net.Config.BasicConfigurator.Configure();
86 _LoggerList[LogCategory.Main] = log4net.LogManager.GetLogger("MAIN");
87 _LoggerList[LogCategory.Socket] = log4net.LogManager.GetLogger("SOCKET");
88 _LoggerList[LogCategory.Queue] = log4net.LogManager.GetLogger("QUEUE");
89 _LoggerList[LogCategory.Connection] = log4net.LogManager.GetLogger("CONNECTION");
90 _LoggerList[LogCategory.IrcMessages] = log4net.LogManager.GetLogger("IRCMESSAGE");
91 _LoggerList[LogCategory.MessageParser] = log4net.LogManager.GetLogger("MESSAGEPARSER");
92 _LoggerList[LogCategory.MessageTypes] = log4net.LogManager.GetLogger("MESSAGETYPES");
93 _LoggerList[LogCategory.ActionHandler] = log4net.LogManager.GetLogger("ACTIONHANDLER");
94 _LoggerList[LogCategory.TimeHandler] = log4net.LogManager.GetLogger("TIMEHANDLER");
95 _LoggerList[LogCategory.MessageHandler] = log4net.LogManager.GetLogger("MESSAGEHANDLER");
96 _LoggerList[LogCategory.ChannelSyncing] = log4net.LogManager.GetLogger("CHANNELSYNCING");
97 _LoggerList[LogCategory.UserSyncing] = log4net.LogManager.GetLogger("USERSYNCING");
98 _LoggerList[LogCategory.Modules] = log4net.LogManager.GetLogger("MODULES");
99 _LoggerList[LogCategory.Dcc] = log4net.LogManager.GetLogger("DCC");
102 public static log4net.ILog Main
104 get {
105 return (log4net.ILog)_LoggerList[LogCategory.Main];
109 public static log4net.ILog Socket
111 get {
112 return (log4net.ILog)_LoggerList[LogCategory.Socket];
116 public static log4net.ILog Queue
118 get {
119 return (log4net.ILog)_LoggerList[LogCategory.Queue];
123 public static log4net.ILog Connection
125 get {
126 return (log4net.ILog)_LoggerList[LogCategory.Connection];
130 public static log4net.ILog IrcMessages
132 get {
133 return (log4net.ILog)_LoggerList[LogCategory.IrcMessages];
137 public static log4net.ILog MessageParser
139 get {
140 return (log4net.ILog)_LoggerList[LogCategory.MessageParser];
144 public static log4net.ILog MessageTypes
146 get {
147 return (log4net.ILog)_LoggerList[LogCategory.MessageTypes];
151 public static log4net.ILog ActionHandler
153 get {
154 return (log4net.ILog)_LoggerList[LogCategory.ActionHandler];
158 public static log4net.ILog TimeHandler
160 get {
161 return (log4net.ILog)_LoggerList[LogCategory.TimeHandler];
165 public static log4net.ILog MessageHandler
167 get {
168 return (log4net.ILog)_LoggerList[LogCategory.MessageHandler];
172 public static log4net.ILog ChannelSyncing
174 get {
175 return (log4net.ILog)_LoggerList[LogCategory.ChannelSyncing];
179 public static log4net.ILog UserSyncing
181 get {
182 return (log4net.ILog)_LoggerList[LogCategory.UserSyncing];
186 public static log4net.ILog Modules
188 get {
189 return (log4net.ILog)_LoggerList[LogCategory.Modules];
193 public static log4net.ILog Dcc
195 get {
196 return (log4net.ILog)_LoggerList[LogCategory.Dcc];
200 #endif