Beispiel #1
0
        public static async void Initialize(string directory, string name)
        {
            if (!IsRunning)
            {
                while (logQueue.Count > 0)
                {
                    var log = logQueue.Take();

                    if (log != null && log != "")
                    {
                        await logger.Write(log);
                    }
                }

                if (!Directory.Exists(directory))
                {
                    Directory.CreateDirectory(directory);
                }

                if (logger == null)
                {
                    logger = new FileLog(directory, name);
                    PacketLog.StartLogTask();
                }
                else
                {
                    logger.Dispose();
                    logger.SetLogFile(directory, name);
                }
            }
            else
            {
                Console.WriteLine("Log Task is still active, please wait a few seconds");
                return;
            }
        }