Blaze.Server.Log.Initialize C# (CSharp) Method

Initialize() public static method

public static Initialize ( string fileName ) : void
fileName string
return void
        public static void Initialize(string fileName)
        {
            _fileName = fileName;
            _writeString = new StringBuilder();

            try
            {
                File.Delete(fileName);
            }
            catch (Exception e)
            {
                Console.WriteLine("Log file couldn't be deleted: {0}", e.ToString());
            }
        }

Usage Example

Beispiel #1
0
        static void Main(string[] args)
        {
            Log.Initialize("Blaze.Server.log");
            Log.Info("Starting Blaze.Server...");

            Time.Initialize();

            try
            {
                Configuration.Load("Blaze.Server.yml");

                if (Configuration.Users == null)
                {
                    Log.Error("Users configuration was not found.");
                    return;
                }
            }
            catch (IOException)
            {
                Log.Error(string.Format("Could not open the configuration file {0}.", "Blaze.Server.yml"));
                return;
            }

            BlazeHubServer.Start();
            BlazeServer.Start();

            while (true)
            {
                try
                {
                    Log.WriteAway();
                }
                catch (Exception ex)
                {
                    Log.Error(ex.ToString());
                }

                Thread.Sleep(1000);
            }
        }