Meebey.SmartIrc4net.Logger.Init C# (CSharp) Method

Init() public static method

public static Init ( ) : void
return void
        public static void Init()
        {
            if (_Init) {
                return;
            }

            _Init = true;

            /*
            FileInfo fi = new FileInfo("SmartIrc4net_log.config");
            if (fi.Exists) {
                    log4net.Config.DOMConfigurator.ConfigureAndWatch(fi);
            } else {
                log4net.Config.BasicConfigurator.Configure();
            }
            */

            _LoggerList[LogCategory.Main]           = log4net.LogManager.GetLogger("MAIN");
            _LoggerList[LogCategory.Socket]         = log4net.LogManager.GetLogger("SOCKET");
            _LoggerList[LogCategory.Queue]          = log4net.LogManager.GetLogger("QUEUE");
            _LoggerList[LogCategory.Connection]     = log4net.LogManager.GetLogger("CONNECTION");
            _LoggerList[LogCategory.IrcMessages]    = log4net.LogManager.GetLogger("IRCMESSAGE");
            _LoggerList[LogCategory.MessageParser]  = log4net.LogManager.GetLogger("MESSAGEPARSER");
            _LoggerList[LogCategory.MessageTypes]   = log4net.LogManager.GetLogger("MESSAGETYPES");
            _LoggerList[LogCategory.ActionHandler]  = log4net.LogManager.GetLogger("ACTIONHANDLER");
            _LoggerList[LogCategory.TimeHandler]    = log4net.LogManager.GetLogger("TIMEHANDLER");
            _LoggerList[LogCategory.MessageHandler] = log4net.LogManager.GetLogger("MESSAGEHANDLER");
            _LoggerList[LogCategory.ChannelSyncing] = log4net.LogManager.GetLogger("CHANNELSYNCING");
            _LoggerList[LogCategory.UserSyncing]    = log4net.LogManager.GetLogger("USERSYNCING");
            _LoggerList[LogCategory.Modules]        = log4net.LogManager.GetLogger("MODULES");
            _LoggerList[LogCategory.Dcc]            = log4net.LogManager.GetLogger("DCC");
        }

Usage Example

Example #1
0
        /// <summary>
        /// Initializes the message queues, read and write thread
        /// </summary>
        public IrcConnection()
        {
#if LOG4NET
            Logger.Init();
            Logger.Main.Debug("IrcConnection created");
#endif
            _SendBuffer[Priority.High]        = Queue.Synchronized(new Queue());
            _SendBuffer[Priority.AboveMedium] = Queue.Synchronized(new Queue());
            _SendBuffer[Priority.Medium]      = Queue.Synchronized(new Queue());
            _SendBuffer[Priority.BelowMedium] = Queue.Synchronized(new Queue());
            _SendBuffer[Priority.Low]         = Queue.Synchronized(new Queue());

            // setup own callbacks
            OnReadLine        += new ReadLineEventHandler(_SimpleParser);
            OnConnectionError += new EventHandler(_OnConnectionError);

            _ReadThread       = new ReadThread(this);
            _WriteThread      = new WriteThread(this);
            _IdleWorkerThread = new IdleWorkerThread(this);

            Assembly     assm      = Assembly.GetAssembly(this.GetType());
            AssemblyName assm_name = assm.GetName(false);

            AssemblyProductAttribute pr = (AssemblyProductAttribute)assm.GetCustomAttributes(typeof(AssemblyProductAttribute), false)[0];

            _VersionNumber = assm_name.Version.ToString();
            _VersionString = pr.Product + " " + _VersionNumber;
        }