NewLine() 공개 정적인 메소드

Write a new line to the log
public static NewLine ( ) : void
리턴 void
예제 #1
0
        /// <summary>
        ///     Loop through all the modules until an update or shutdown is pending
        /// </summary>
        protected virtual void ModuleLooper()
        {
            Log.NewLine();

            // Only run the service if there isn't a shutdown or update pending
            // However, keep looping if a power operation is only Requested as
            // the request may be aborted
            while (!Power.ShuttingDown && !Power.Updating)
            {
                LoopData = GetLoopData() ?? new Response();
                // Stop looping as soon as a shutdown or update pending
                foreach (var module in GetModules().TakeWhile(module => !Power.ShuttingDown && !Power.Updating))
                {
                    // Entry file formatting
                    Log.NewLine();
                    Log.PaddedHeader(module.GetName());
                    Log.Entry("Client-Info", $"Client Version: {Settings.Get("Version")}");
                    Log.Entry("Client-Info", $"Client OS:      {Settings.OS}");
                    Log.Entry("Client-Info", $"Server Version: {Settings.Get("ServerVersion")}");

                    try
                    {
                        var subResponse = LoopData.GetSubResponse(module.GetName().ToLower());
                        if (subResponse == null)
                        {
                            continue;
                        }

                        module.Start(subResponse);
                    }
                    catch (Exception ex)
                    {
                        Log.Error(Name, "Unable to run module");
                        Log.Error(Name, ex);
                    }

                    // Entry file formatting
                    Log.Divider();
                    Log.NewLine();
                }

                // Skip checking for sleep time if there is a shutdown or update pending
                if (Power.ShuttingDown || Power.Updating)
                {
                    break;
                }

                // Once all modules have been run, sleep for the set time
                var sleepTime = GetSleepTime() ?? DEFAULT_SLEEP_TIME;
                Log.Entry(Name, $"Sleeping for {sleepTime} seconds");
                Thread.Sleep(sleepTime * 1000);
            }
        }
예제 #2
0
 /// <summary>
 ///     Start the service
 /// </summary>
 public virtual void Start()
 {
     Log.NewLine();
     Log.Entry(Name, "Starting service");
     // Only start if a valid server address is present
     if (string.IsNullOrEmpty(Configuration.ServerAddress))
     {
         Log.Error(Name, "ServerAddress not found! Exiting.");
         return;
     }
     _moduleThread.Start();
 }