Beispiel #1
0
        public static void WriteLog(LogLevel logLevel, string fmt, params object[] args)
        {
            string log = string.Format(fmt, args);

            if (logLevel.Equals(LogLevel.DEBUG))
            {
                logger.Debug(log);
            }
            else if (logLevel.Equals(LogLevel.ERROR))
            {
                logger.Error(log);
            }
            else if (logLevel.Equals(LogLevel.FATAL))
            {
                logger.Fatal(log);
            }
            else if (logLevel.Equals(LogLevel.INFO))
            {
                logger.Info(log);
            }
            else if (logLevel.Equals(LogLevel.WARN))
            {
                logger.Warn(log);
            }
        }
Beispiel #2
0
 public void Log(string message)
 {
     if (LoggingLevel.Equals(LogLevel.Debug))
     {
         Logger.Write(GetLogEntry(LogCategory.Log, message, LogPriortiy.Medium, TraceEventType.Information));
     }
 }
Beispiel #3
0
 public void Log(LogLevel level, string message)
 {
     if (level.Equals(LogLevel.Error) || level.Equals(LogLevel.Fatal))
     {
         Assert.Fail(message);
     }
 }
Beispiel #4
0
        public void LogMessage(string message, LogLevel level)
        {
            message.Trim();

            if (message == null || message.Length == 0)
            {
                return;
            }
            if ((!LogMessages && level.Equals(LogLevel.Message)) ||
                (!LogWarnings && level.Equals(LogLevel.Warning)) ||
                (!LogErrors && level.Equals(LogLevel.Error)))
            {
                return;
            }

            if (LogToDataBase)
            {
                LogMessageInDataBase(message, level);
            }

            if (LogToFile)
            {
                LogMessageInFile(message, level);
            }

            if (LogToConsole)
            {
                LogMessageInConsole(message, level);
            }
        }
Beispiel #5
0
 public static void WriteLog(LogLevel logLevel, string log, HttpContext context, Exception ex)
 {
     log = log + Environment.NewLine + "Rawurl : " + context.Request.RawUrl + Environment.NewLine + "URL : " + context.Request.Url.ToString() + Environment.NewLine +
           "Message : " + ex.Message + Environment.NewLine + "InnerException : " + ex.InnerException + Environment.NewLine + "Stacktrace : " + ex.StackTrace;
     if (logLevel.Equals(LogLevel.DEBUG))
     {
         logger.Debug(log);
     }
     else if (logLevel.Equals(LogLevel.ERROR))
     {
         logger.Error(log);
     }
     else if (logLevel.Equals(LogLevel.FATAL))
     {
         logger.Fatal(log);
     }
     else if (logLevel.Equals(LogLevel.INFO))
     {
         logger.Info(log);
     }
     else if (logLevel.Equals(LogLevel.WARN))
     {
         logger.Warn(log);
     }
 }
Beispiel #6
0
 /// <summary>
 /// Log an exception object with custom additional information (for instance variable values at the time of the exception), example use in a catch block
 /// </summary>
 /// <param name="level">The LogLevel to assign to this message</param>
 /// <param name="e">The exception object to log</param>
 /// <param name="comment">Any additional information</param>
 public void log(LogLevel level, Exception e, String comment)
 {
     if ((int)loggerLevel <= (int)level)
     {
         WPCException ex = new WPCException(level, e, comment);
         if (Debugger.IsAttached)
         {
             Debug.WriteLine(ex.getDebugOutput());
         }
         if (toFile || level.Equals(LogLevel.critical) || level.Equals(LogLevel.error))
         {
             logToFile(ex);
         }
     }
 }
Beispiel #7
0
        /// <summary>
        /// mapping log level with event log level
        /// </summary>
        /// <param name="logLevel">log level of message</param>
        /// <returns>Event log level enum of same msg</returns>
        private EventLogEntryType GetEventLogLevel(LogLevel logLevel)
        {
            EventLogEntryType eventLogLevel = EventLogEntryType.Information;

            if (logLevel.Equals(LogLevel.Warning))
            {
                eventLogLevel = EventLogEntryType.Information;
            }
            else if (logLevel.Equals(LogLevel.Error))
            {
                eventLogLevel = EventLogEntryType.Error;
            }

            return(eventLogLevel);
        }
Beispiel #8
0
 public static void debug(String text)
 {
     if (logLevel.Equals(LogLevel.DEBUG))
     {
         Console.WriteLine($"[DEBUG] {text}");
     }
 }
Beispiel #9
0
        /// <summary>
        ///     Passes one log entry to the destination logger and associated exception information.
        /// </summary>
        /// <remarks>
        ///     Use this form of the method when <see cref="NLog.LogLevel.Error" /> or
        ///     <see cref="NLog.LogLevel.Fatal" /> is used.
        /// </remarks>
        /// <param name="caller">
        ///     <see cref="System.String" /> holding information about the calling method.
        /// </param>
        /// <param name="eventId">
        ///     Four character unique event ID as <see cref="System.String" />.
        /// </param>
        /// <param name="level">
        ///     The <see cref="NLog.LogLevel" /> value.
        /// </param>
        /// <param name="message">
        ///     The message to save to the log file as <see cref="System.String" />.
        /// </param>
        /// <param name="ex">
        ///     If this is an error log event, pass it as an <see cref="System.Exception" /> object.
        /// </param>
        internal void GenerateLog(string eventId, LogLevel level, string message, Exception ex)
        {
            // Values used for all events.
            LogEventInfo logEvent = new LogEventInfo();

            logEvent.Properties["EventCode"] = eventId;
            logEvent.Level     = level;
            logEvent.Message   = message;
            logEvent.Exception = ex;
            // Actually write the log entry.
            _log.Log(logEvent);
            if (level.Equals(LogLevel.Error) || level.Equals(LogLevel.Fatal))
            {
                Environment.Exit(Convert.ToInt32(eventId));
            }
        }
Beispiel #10
0
 public void Log(LogLevel level, string str)
 {
     if (level.Equals(LogLevel.Info))
     {
         Console.WriteLine(str);
     }
 }
Beispiel #11
0
            public bool IsEnabled(LogLevel logLevel)
            {
                IsEnabledCalled = true;
                var enabled = logLevel.Equals(_currentLevel);

                return(enabled);
            }
Beispiel #12
0
        /// <summary>
        /// Logs information and writes it to the console
        /// </summary>
        /// <param name="message">The message to log</param>
        /// <param name="level">LogLevel value, gets compared to the configured logLevel variable</param>
        public void Log(object message, LogLevel level)
        {
            //set thread context properties
            SetContext();
            foreach (var log in logs)
            {
                switch (level)
                {
                case LogLevel.Trace:
                    //log4net has no Trace so Trace and Debug are the same
                    log.Debug(message);
                    break;

                case LogLevel.Debug:
                    log.Debug(message);
                    break;

                case LogLevel.Info:
                    log.Info(message);
                    break;

                case LogLevel.Warn:
                    log.Warn(message);
                    break;

                case LogLevel.Error:
                    log.Error(message);
                    break;

                case LogLevel.Critical:
                    log.Fatal(message);
                    break;
                }
            }

            //errors are special - they are exceptions that don't stop the program but we want to write them to a database
            //table
            if (level.Equals(LogLevel.Error) && errorLogDB != null && dataUtils != null)
            {
                string headers = "Agent: " + Config.AgentType;
                if (Config.Master != null)
                {
                    headers += " Master: " + Config.Master;
                    headers += " DB: " + Config.MasterDB;
                }
                else if (Config.Slave != null)
                {
                    headers += " Slave: " + Config.Slave;
                    headers += " DB: " + Config.SlaveDB;
                }
                else
                {
                    headers += " Relay: " + Config.RelayServer;
                    headers += " DB: " + Config.RelayDB;
                }

                dataUtils.LogError(message.ToString(), headers);
            }
        }
Beispiel #13
0
        public bool Login(X509Certificate2 ownCertificate)
        {
            if (IsRunning)
            {
                return(false);
            }
            try
            {
                if (LogLevel != null)
                {
                    if (LogLevel.Equals("Debug"))
                    {
                        VoluntLib2.Tools.Logger.SetLogLevel(Logtype.Debug);
                    }
                    else if (LogLevel.Equals("Info"))
                    {
                        VoluntLib2.Tools.Logger.SetLogLevel(Logtype.Info);
                    }
                    else if (LogLevel.Equals("Warning"))
                    {
                        VoluntLib2.Tools.Logger.SetLogLevel(Logtype.Warning);
                    }
                    else if (LogLevel.Equals("Error"))
                    {
                        VoluntLib2.Tools.Logger.SetLogLevel(Logtype.Error);
                    }
                }
                else
                {
                    VoluntLib2.Tools.Logger.SetLogLevel(Logtype.Warning);
                }

                //root certificate for checking signatures
                var rootCertificate = new X509Certificate2(Resources.rootCA);
                //well known peers for boostrapping p2p network
                var wellKnownPeers     = Resources.wellKnownPeers.Replace("\r", "");
                var wellKnownPeersList = wellKnownPeers.Split('\n').ToList();
                voluntLib.WellKnownPeers.Clear();
                voluntLib.WellKnownPeers.AddRange(wellKnownPeersList);
                //start voluntlib now:
                voluntLib.Start(rootCertificate, ownCertificate);
                //When VoluntLib is started, the admin and banned lists are cleared
                //Thus, we here add the admin and banned certificates
                var adminCertificates  = Resources.adminCertificates.Replace("\r", "");
                var adminList          = adminCertificates.Split('\n').ToList();
                var bannedCertificates = Resources.bannedCertificates.Replace("\r", "");
                var bannedList         = bannedCertificates.Split('\n').ToList();
                CertificateService.GetCertificateService().AdminCertificateList.AddRange(adminList);
                CertificateService.GetCertificateService().BannedCertificateList.AddRange(bannedList);

                OnConnectionStateChanged(true);
            }
            catch (Exception)
            {
                return(false);
            }
            return(true);
        }
 protected override void LogLine(LogLevel level, string line)
 {
     if (level.Equals(LogLevel.Trace))
     {
         System.Diagnostics.Trace.WriteLine(line, m_logName);
     }
     else
     {
         System.Diagnostics.Debug.WriteLine(line, m_logName);
     }            
 }
        public void Log(LogLevel level, string msgStr, string trace = null)
        {
            var msgAll = msgStr + trace;

            this.BeginInvoke(new EventHandler(delegate
            {
                foreach (var msg in Split(msgAll, 70))
                {
                    var levelStr = GetDescription(level);
                    if (level.Equals(LogLevel.ERROR))
                    {
                        logList.Items.Add(new DuiHtmlLabel
                        {
                            Text     = string.Format("&nbsp;&nbsp; <label color='red'>[{0:yyyy-MM-dd HH:mm:ss} {1}]--------{2} </label>", DateTime.Now, levelStr, msg),
                            AutoSize = true
                        });
                    }
                    else if (level.Equals(LogLevel.WARN))
                    {
                        logList.Items.Add(new DuiHtmlLabel
                        {
                            Text     = string.Format("&nbsp;&nbsp; <label color='blue'>[{0:yyyy-MM-dd HH:mm:ss} {1}]--------{2} </label>", DateTime.Now, levelStr, msg),
                            AutoSize = true
                        });
                    }
                    else
                    {
                        logList.Items.Add(new DuiHtmlLabel
                        {
                            Text     = string.Format("&nbsp;&nbsp; [{0:yyyy-MM-dd HH:mm:ss} {1}]--------{2}", DateTime.Now, levelStr, msg),
                            AutoSize = true
                        });
                    }
                }

                SetTimeout(100, () =>
                {
                    logList.Value = 1;
                });
            }));
        }
 public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter)
 {
     this.logger.Log(logLevel, eventId, state, exception, formatter);
     if (logLevel.Equals(LogLevel.Information))
     {
         this.signalRMessagesCollector.AddAsync(new SignalRMessage()
         {
             Target    = "console",
             Arguments = new[] { formatter(state, exception) }
         }).GetAwaiter().GetResult();
     }
 }
Beispiel #17
0
 /// <summary>Writes to the log.</summary>
 /// <param name="logLevel">The log level.</param>
 /// <param name="log">The log message.</param>
 public static void WriteLog(LogLevel logLevel, string log)
 {
     if (logLevel.Equals(LogLevel.DEBUG))
     {
         Logger.Debug(log);
     }
     else if (logLevel.Equals(LogLevel.ERROR))
     {
         Logger.Error(log);
     }
     else if (logLevel.Equals(LogLevel.FATAL))
     {
         Logger.Fatal(log);
     }
     else if (logLevel.Equals(LogLevel.INFO))
     {
         Logger.Info(log);
     }
     else if (logLevel.Equals(LogLevel.WARN))
     {
         Logger.Warn(log);
     }
 }
Beispiel #18
0
 public static void WriteLog(LogLevel logLevel, String log)
 {
     if (logLevel.Equals(LogLevel.DEBUG))
     {
         logger.Debug(log);
     }
     else if (logLevel.Equals(LogLevel.ERROR))
     {
         logger.Error(log);
     }
     else if (logLevel.Equals(LogLevel.FATAL))
     {
         logger.Fatal(log);
     }
     else if (logLevel.Equals(LogLevel.INFO))
     {
         logger.Info(log);
     }
     else if (logLevel.Equals(LogLevel.WARNING))
     {
         logger.Warn(log);
     }
 }
Beispiel #19
0
        public static void Main_8_4_5()//Main_8_4_5
        {
            LogLevel logger = LogLevel.Information;

            Console.WriteLine("The log level is {0}.", logger.ToString());
            LogLevel log = LogLevel.Information;

            Console.WriteLine(log.Equals(logger));
            Console.WriteLine(ReferenceEquals(log, logger));
            object o = (object)LogLevel.Information;

            GetCurrentLog(log);

            int logger3 = LoggerLevel.Warnning;

            GetCurrentLogger(logger3);
        }
        /// <summary>
        /// Returns true if OrgApacheSlingDistributionAgentImplSimpleDistributionAgentFactorProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of OrgApacheSlingDistributionAgentImplSimpleDistributionAgentFactorProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrgApacheSlingDistributionAgentImplSimpleDistributionAgentFactorProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                     ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     Details == other.Details ||
                     Details != null &&
                     Details.Equals(other.Details)
                 ) &&
                 (
                     Enabled == other.Enabled ||
                     Enabled != null &&
                     Enabled.Equals(other.Enabled)
                 ) &&
                 (
                     ServiceName == other.ServiceName ||
                     ServiceName != null &&
                     ServiceName.Equals(other.ServiceName)
                 ) &&
                 (
                     LogLevel == other.LogLevel ||
                     LogLevel != null &&
                     LogLevel.Equals(other.LogLevel)
                 ) &&
                 (
                     QueueProcessingEnabled == other.QueueProcessingEnabled ||
                     QueueProcessingEnabled != null &&
                     QueueProcessingEnabled.Equals(other.QueueProcessingEnabled)
                 ) &&
                 (
                     PackageExporterTarget == other.PackageExporterTarget ||
                     PackageExporterTarget != null &&
                     PackageExporterTarget.Equals(other.PackageExporterTarget)
                 ) &&
                 (
                     PackageImporterTarget == other.PackageImporterTarget ||
                     PackageImporterTarget != null &&
                     PackageImporterTarget.Equals(other.PackageImporterTarget)
                 ) &&
                 (
                     RequestAuthorizationStrategyTarget == other.RequestAuthorizationStrategyTarget ||
                     RequestAuthorizationStrategyTarget != null &&
                     RequestAuthorizationStrategyTarget.Equals(other.RequestAuthorizationStrategyTarget)
                 ) &&
                 (
                     TriggersTarget == other.TriggersTarget ||
                     TriggersTarget != null &&
                     TriggersTarget.Equals(other.TriggersTarget)
                 ));
        }
Beispiel #21
0
        /// <summary>
        /// Returns true if OrgApacheSlingDistributionAgentImplSyncDistributionAgentFactoryProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of OrgApacheSlingDistributionAgentImplSyncDistributionAgentFactoryProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrgApacheSlingDistributionAgentImplSyncDistributionAgentFactoryProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                     ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     Details == other.Details ||
                     Details != null &&
                     Details.Equals(other.Details)
                 ) &&
                 (
                     Enabled == other.Enabled ||
                     Enabled != null &&
                     Enabled.Equals(other.Enabled)
                 ) &&
                 (
                     ServiceName == other.ServiceName ||
                     ServiceName != null &&
                     ServiceName.Equals(other.ServiceName)
                 ) &&
                 (
                     LogLevel == other.LogLevel ||
                     LogLevel != null &&
                     LogLevel.Equals(other.LogLevel)
                 ) &&
                 (
                     QueueProcessingEnabled == other.QueueProcessingEnabled ||
                     QueueProcessingEnabled != null &&
                     QueueProcessingEnabled.Equals(other.QueueProcessingEnabled)
                 ) &&
                 (
                     PassiveQueues == other.PassiveQueues ||
                     PassiveQueues != null &&
                     PassiveQueues.Equals(other.PassiveQueues)
                 ) &&
                 (
                     PackageExporterEndpoints == other.PackageExporterEndpoints ||
                     PackageExporterEndpoints != null &&
                     PackageExporterEndpoints.Equals(other.PackageExporterEndpoints)
                 ) &&
                 (
                     PackageImporterEndpoints == other.PackageImporterEndpoints ||
                     PackageImporterEndpoints != null &&
                     PackageImporterEndpoints.Equals(other.PackageImporterEndpoints)
                 ) &&
                 (
                     RetryStrategy == other.RetryStrategy ||
                     RetryStrategy != null &&
                     RetryStrategy.Equals(other.RetryStrategy)
                 ) &&
                 (
                     RetryAttempts == other.RetryAttempts ||
                     RetryAttempts != null &&
                     RetryAttempts.Equals(other.RetryAttempts)
                 ) &&
                 (
                     PullItems == other.PullItems ||
                     PullItems != null &&
                     PullItems.Equals(other.PullItems)
                 ) &&
                 (
                     HttpConnTimeout == other.HttpConnTimeout ||
                     HttpConnTimeout != null &&
                     HttpConnTimeout.Equals(other.HttpConnTimeout)
                 ) &&
                 (
                     RequestAuthorizationStrategyTarget == other.RequestAuthorizationStrategyTarget ||
                     RequestAuthorizationStrategyTarget != null &&
                     RequestAuthorizationStrategyTarget.Equals(other.RequestAuthorizationStrategyTarget)
                 ) &&
                 (
                     TransportSecretProviderTarget == other.TransportSecretProviderTarget ||
                     TransportSecretProviderTarget != null &&
                     TransportSecretProviderTarget.Equals(other.TransportSecretProviderTarget)
                 ) &&
                 (
                     PackageBuilderTarget == other.PackageBuilderTarget ||
                     PackageBuilderTarget != null &&
                     PackageBuilderTarget.Equals(other.PackageBuilderTarget)
                 ) &&
                 (
                     TriggersTarget == other.TriggersTarget ||
                     TriggersTarget != null &&
                     TriggersTarget.Equals(other.TriggersTarget)
                 ));
        }
Beispiel #22
0
        public FunkyWindow()
        {
            Settings_Funky.LoadFunkyConfiguration();

            Owner         = App.Current.MainWindow;
            Title         = "Funky Settings -- " + Bot.Character.Account.CurrentHeroName;
            SizeToContent = SizeToContent.WidthAndHeight;
            ResizeMode    = ResizeMode.CanMinimize;
            Background    = Brushes.Black;
            Foreground    = Brushes.PaleGoldenrod;
            //this.Width=600;
            //this.Height=600;

            ListBox LBWindowContent = new ListBox
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
            };

            Menu Menu_Settings = new Menu
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
            };
            MenuItem Menu_Defaults = new MenuItem
            {
                Header   = "Settings",
                Height   = 25,
                FontSize = 12,
            };
            MenuItem Menu_Default_Open = new MenuItem
            {
                Header   = "Open File..",
                Height   = 25,
                FontSize = 12,
            };

            Menu_Default_Open.Click += DefaultMenuLoadProfileClicked;
            Menu_Defaults.Items.Add(Menu_Default_Open);
            MenuItem Menu_Default_Leveling = new MenuItem
            {
                Header   = "Use Default Leveling",
                Height   = 25,
                FontSize = 12,
            };

            Menu_Default_Leveling.Click += DefaultMenuLevelingClicked;
            Menu_Defaults.Items.Add(Menu_Default_Leveling);
            MenuItem Menu_ViewSettingFile = new MenuItem
            {
                Header   = "Open Settings File",
                Height   = 25,
                FontSize = 12,
            };

            Menu_ViewSettingFile.Click += DefaultOpenSettingsFileClicked;
            Menu_Defaults.Items.Add(Menu_ViewSettingFile);

            Menu_Settings.Items.Add(Menu_Defaults);
            LBWindowContent.Items.Add(Menu_Settings);

            TabControl tabControl1 = new TabControl
            {
                Width  = 600,
                Height = 600,
                HorizontalAlignment        = HorizontalAlignment.Stretch,
                VerticalAlignment          = VerticalAlignment.Stretch,
                VerticalContentAlignment   = VerticalAlignment.Stretch,
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                FontSize = 12,
            };

            LBWindowContent.Items.Add(tabControl1);

            #region Combat
            //Character
            TabItem CombatSettingsTabItem = new TabItem();
            CombatSettingsTabItem.Header = "Combat";

            tabControl1.Items.Add(CombatSettingsTabItem);
            CombatTabControl = new TabControl
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
            };

            InitCombatControls();

            InitClusteringControls();

            InitGroupingControls();

            InitAvoidanceControls();

            InitFleeingControls();

            InitPlayerClassControls();



            CombatSettingsTabItem.Content = CombatTabControl;
            #endregion


            #region Targeting
            TabItem TargetTabItem = new TabItem();
            TargetTabItem.Header = "Targeting";
            tabControl1.Items.Add(TargetTabItem);

            tcTargeting = new TabControl
            {
                Height    = 600,
                Width     = 600,
                Focusable = false,
            };

            InitTargetingGeneralControls();
            InitTargetRangeControls();
            InitLOSMovementControls();

            TargetTabItem.Content = tcTargeting;

            #endregion


            #region General
            tcGeneral = new TabControl
            {
                Width  = 600,
                Height = 600,
            };

            TabItem GeneralSettingsTabItem = new TabItem();
            GeneralSettingsTabItem.Header = "General";
            tabControl1.Items.Add(GeneralSettingsTabItem);

            InitGeneralControls();

            GeneralSettingsTabItem.Content = tcGeneral;
            #endregion


            #region Items


            TabItem CustomSettingsTabItem = new TabItem();
            CustomSettingsTabItem.Header = "Items";
            tabControl1.Items.Add(CustomSettingsTabItem);

            tcItems = new TabControl
            {
                Width  = 600,
                Height = 600
            };

            InitItemRulesControls();
            InitLootPickUpControls();
            InitItemScoringControls();

            CustomSettingsTabItem.Content = tcItems;
            #endregion


            TabItem AdvancedTabItem = new TabItem();
            AdvancedTabItem.Header = "Advanced";
            tabControl1.Items.Add(AdvancedTabItem);
            ListBox lbAdvancedContent = new ListBox();

            #region Debug Logging
            StackPanel SPLoggingOptions    = new StackPanel();
            TextBlock  Logging_Text_Header = new TextBlock
            {
                Text                = "Debug Output Options",
                FontSize            = 12,
                Background          = Brushes.LightSeaGreen,
                TextAlignment       = TextAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Stretch,
            };
            SPLoggingOptions.Children.Add(Logging_Text_Header);

            CheckBox CBDebugStatusBar = new CheckBox
            {
                Content   = "Enable Debug Status Bar",
                Width     = 300,
                Height    = 20,
                IsChecked = Bot.Settings.Debug.DebugStatusBar,
            };
            CBDebugStatusBar.Checked   += DebugStatusBarChecked;
            CBDebugStatusBar.Unchecked += DebugStatusBarChecked;
            SPLoggingOptions.Children.Add(CBDebugStatusBar);


            TextBlock Logging_FunkyLogLevels_Header = new TextBlock
            {
                Text                = "Funky Logging Options",
                FontSize            = 12,
                Background          = Brushes.MediumSeaGreen,
                TextAlignment       = TextAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Stretch,
            };

            StackPanel panelFunkyLogFlags = new StackPanel
            {
                Orientation       = Orientation.Vertical,
                VerticalAlignment = VerticalAlignment.Stretch,
            };
            panelFunkyLogFlags.Children.Add(Logging_FunkyLogLevels_Header);

            var LogLevels = Enum.GetValues(typeof(LogLevel));
            Logger.GetLogLevelName fRetrieveNames = s => Enum.GetName(typeof(LogLevel), s);

            CBLogLevels = new CheckBox[LogLevels.Length - 2];
            int  counter = 0;
            bool noFlags = Bot.Settings.Debug.FunkyLogFlags.Equals(LogLevel.None);
            foreach (var logLevel in LogLevels)
            {
                LogLevel thisloglevel = (LogLevel)logLevel;
                if (thisloglevel.Equals(LogLevel.None) || thisloglevel.Equals(LogLevel.All))
                {
                    continue;
                }

                string loglevelName = fRetrieveNames(logLevel);
                CBLogLevels[counter] = new CheckBox
                {
                    Name      = loglevelName,
                    Content   = loglevelName,
                    IsChecked = !noFlags?Bot.Settings.Debug.FunkyLogFlags.HasFlag(thisloglevel) : false,
                };
                CBLogLevels[counter].Checked   += FunkyLogLevelChanged;
                CBLogLevels[counter].Unchecked += FunkyLogLevelChanged;

                panelFunkyLogFlags.Children.Add(CBLogLevels[counter]);
                counter++;
            }

            StackPanel  StackPanelLogLevelComboBoxes = new StackPanel();
            RadioButton cbLogLevelNone = new RadioButton
            {
                Name    = "LogLevelNone",
                Content = "None",
            };
            cbLogLevelNone.Checked += FunkyLogLevelComboBoxSelected;
            RadioButton cbLogLevelAll = new RadioButton
            {
                Name    = "LogLevelAll",
                Content = "All",
            };
            cbLogLevelAll.Checked += FunkyLogLevelComboBoxSelected;

            StackPanelLogLevelComboBoxes.Children.Add(cbLogLevelNone);
            StackPanelLogLevelComboBoxes.Children.Add(cbLogLevelAll);
            panelFunkyLogFlags.Children.Add(StackPanelLogLevelComboBoxes);

            SPLoggingOptions.Children.Add(panelFunkyLogFlags);

            lbAdvancedContent.Items.Add(SPLoggingOptions);
            #endregion



            CheckBox CBSkipAhead = new CheckBox
            {
                Content   = "Skip Ahead Feature (TrinityMoveTo/Explore)",
                Width     = 300,
                Height    = 20,
                IsChecked = Bot.Settings.Debug.SkipAhead,
            };
            CBSkipAhead.Checked   += SkipAheadChecked;
            CBSkipAhead.Unchecked += SkipAheadChecked;
            lbAdvancedContent.Items.Add(CBSkipAhead);


            //CheckBox CBLineOfSightBehavior = new CheckBox
            //{
            //    Content = "Enable Line-Of-Sight Behavior",
            //    Width = 300,
            //    Height = 20,
            //    IsChecked = Bot.Settings.Plugin.EnableLineOfSightBehavior,
            //};
            //CBLineOfSightBehavior.Checked += LineOfSightBehaviorChecked;
            //CBLineOfSightBehavior.Unchecked += LineOfSightBehaviorChecked;
            //lbAdvancedContent.Items.Add(CBLineOfSightBehavior);

            AdvancedTabItem.Content = lbAdvancedContent;

            TabItem MiscTabItem = new TabItem();
            MiscTabItem.Header = "Misc";
            tabControl1.Items.Add(MiscTabItem);
            ListBox lbMiscContent = new ListBox();
            try
            {
                GameStats cur = Bot.Game.CurrentGameStats;
                lbMiscContent.Items.Add("\r\n== CURRENT GAME SUMMARY ==");
                lbMiscContent.Items.Add(String.Format("Total Profiles:{0}\r\nDeaths:{1} TotalTime:{2} TotalGold:{3} TotalXP:{4}\r\n{5}",
                                                      cur.Profiles.Count, cur.TotalDeaths, cur.TotalTimeRunning.ToString(@"hh\ \h\ mm\ \m\ ss\ \s"), cur.TotalGold, cur.TotalXP, cur.TotalLootTracker.ToString()));

                if (Bot.Game.CurrentGameStats.Profiles.Count > 0)
                {
                    lbMiscContent.Items.Add("\r\n== PROFILES ==");
                    foreach (var item in Bot.Game.CurrentGameStats.Profiles)
                    {
                        lbMiscContent.Items.Add(String.Format("{0}\r\nDeaths:{1} TotalTime:{2} TotalGold:{3} TotalXP:{4}\r\n{5}",
                                                              item.ProfileName, item.DeathCount, item.TotalTimeSpan.ToString(@"hh\ \h\ mm\ \m\ ss\ \s"), item.TotalGold, item.TotalXP, item.LootTracker.ToString()));
                    }
                }


                TotalStats all = Bot.Game.TrackingStats;
                lbMiscContent.Items.Add("\r\n== CURRENT GAME SUMMARY ==");
                lbMiscContent.Items.Add(String.Format("Total Games:{0} -- Total Unique Profiles:{1}\r\nDeaths:{2} TotalTime:{3} TotalGold:{4} TotalXP:{5}\r\n{6}",
                                                      all.GameCount, all.Profiles.Count, all.TotalDeaths, all.TotalTimeRunning.ToString(@"hh\ \h\ mm\ \m\ ss\ \s"), all.TotalGold, all.TotalXP, all.TotalLootTracker.ToString()));
            }
            catch
            {
                lbMiscContent.Items.Add("Exception Handled");
            }

            MiscTabItem.Content = lbMiscContent;



            TabItem DebuggingTabItem = new TabItem
            {
                Header = "Debug",
                VerticalContentAlignment = VerticalAlignment.Stretch,
                VerticalAlignment        = VerticalAlignment.Stretch,
            };
            tabControl1.Items.Add(DebuggingTabItem);
            DockPanel DockPanel_Debug = new DockPanel
            {
                LastChildFill = true,
                FlowDirection = FlowDirection.LeftToRight,
            };


            Button btnObjects_Debug = new Button
            {
                Content  = "Object Cache",
                FontSize = 10,
                Width    = 80,
                Height   = 25,
                Name     = "Objects",
            };
            btnObjects_Debug.Click += DebugButtonClicked;
            Button btnObstacles_Debug = new Button
            {
                Content  = "Obstacle Cache",
                Width    = 80,
                FontSize = 10,
                Height   = 25,
                Name     = "Obstacles",
            };
            btnObstacles_Debug.Click += DebugButtonClicked;
            Button btnSNO_Debug = new Button
            {
                Content  = "SNO Cache",
                FontSize = 10,
                Width    = 80,
                Height   = 25,
                Name     = "SNO",
            };
            btnSNO_Debug.Click += DebugButtonClicked;
            Button btnAbility_Debug = new Button
            {
                Content  = "Ability Cache",
                FontSize = 10,
                Width    = 80,
                Height   = 25,
                Name     = "Ability",
            };
            btnAbility_Debug.Click += DebugButtonClicked;
            Button btnMGP_Debug = new Button
            {
                Content = "MGP Details",
                Width   = 150,
                Height  = 25,
                Name    = "MGP",
            };
            btnMGP_Debug.Click += DebugButtonClicked;
            Button btnCharacterCache_Debug = new Button
            {
                Content  = "Character",
                FontSize = 10,
                Width    = 80,
                Height   = 25,
                Name     = "CHARACTER",
            };
            btnCharacterCache_Debug.Click += DebugButtonClicked;
            Button btnTargetMovement_Debug = new Button
            {
                Content  = "TargetMove",
                FontSize = 10,
                Width    = 80,
                Height   = 25,
                Name     = "TargetMove",
            };
            btnTargetMovement_Debug.Click += DebugButtonClicked;
            Button btnCombatCache_Debug = new Button
            {
                Content  = "CombatCache",
                FontSize = 10,
                Width    = 80,
                Height   = 25,
                Name     = "CombatCache",
            };
            btnCombatCache_Debug.Click += DebugButtonClicked;
            Button btnTEST_Debug = new Button
            {
                Content  = "Test",
                FontSize = 10,
                Width    = 80,
                Height   = 25,
                Name     = "TEST",
            };
            btnTEST_Debug.Click += DebugButtonClicked;



            StackPanel StackPanel_DebugButtons = new StackPanel
            {
                Height = 40,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                FlowDirection       = FlowDirection.LeftToRight,
                Orientation         = Orientation.Horizontal,
                VerticalAlignment   = VerticalAlignment.Top,
            };
            StackPanel_DebugButtons.Children.Add(btnObjects_Debug);
            StackPanel_DebugButtons.Children.Add(btnObstacles_Debug);
            StackPanel_DebugButtons.Children.Add(btnSNO_Debug);
            StackPanel_DebugButtons.Children.Add(btnAbility_Debug);
            StackPanel_DebugButtons.Children.Add(btnCharacterCache_Debug);
            StackPanel_DebugButtons.Children.Add(btnCombatCache_Debug);
            StackPanel_DebugButtons.Children.Add(btnTEST_Debug);

            //StackPanel_DebugButtons.Children.Add(btnGPC_Debug);

            DockPanel.SetDock(StackPanel_DebugButtons, Dock.Top);
            DockPanel_Debug.Children.Add(StackPanel_DebugButtons);

            LBDebug = new ListBox
            {
                SelectionMode              = SelectionMode.Extended,
                HorizontalAlignment        = HorizontalAlignment.Stretch,
                VerticalAlignment          = VerticalAlignment.Stretch,
                VerticalContentAlignment   = VerticalAlignment.Stretch,
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                FontSize    = 10,
                FontStretch = FontStretches.SemiCondensed,
                Background  = Brushes.Black,
                Foreground  = Brushes.GhostWhite,
            };

            DockPanel_Debug.Children.Add(LBDebug);

            DebuggingTabItem.Content = DockPanel_Debug;


            AddChild(LBWindowContent);
        }
Beispiel #23
0
    public void Write(LogLevel level, string msg)
    {
        var output = level.Equals(LogLevel.Error) ? Console.Error : Console.Out;

        output.WriteLine(msg);
    }
Beispiel #24
0
        public void Print(LogLevel level, string message)
        {
            if (level >= logLevel)
            {
                DateTime stamp = DateTime.Now;
                StreamWriter logWriter;

                if (!File.Exists(logFilePath))
                    logWriter = File.CreateText(logFilePath);
                else
                    logWriter = File.AppendText(logFilePath);

                string levelText = "";
                if (level.Equals(LogLevel.Debug) || level.Equals(LogLevel.Info))
                    levelText = "[" + level.ToString() + "]\t\t";
                if (level.Equals(LogLevel.Exception))
                    levelText = "[" + level.ToString() + "]\t";

                string logOut = levelText + stamp.ToString("u") + "." + stamp.Millisecond.ToString("000") + " * " + message;
                logWriter.WriteLine(logOut);

                if (writeToConsole)
                {
                    if (level.Equals(LogLevel.Exception))
                    {
                        var color = Console.ForegroundColor;
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(logOut);
                        Console.ForegroundColor = color;
                    }

                    Console.WriteLine(logOut);
                }

                logWriter.Flush();
                logWriter.Close();
            }
        }
Beispiel #25
0
 /// <summary>
 /// Log an exception object with custom additional information (for instance variable values at the time of the exception), example use in a catch block
 /// </summary>
 /// <param name="level">The LogLevel to assign to this message</param>
 /// <param name="e">The exception object to log</param>
 /// <param name="comment">Any additional information</param>
 public void log(LogLevel level, Exception e, String comment)
 {
     if ((int)loggerLevel <= (int)level)
     {
         WPCException ex = new WPCException(level, e, comment);
         if (Debugger.IsAttached)
         {
             Debug.WriteLine(ex.getDebugOutput());
         }
         if (toFile || level.Equals(LogLevel.critical))
         {
             logToFile(ex);
         }
     }
 }
Beispiel #26
0
        public static void WriteLog(LogLevel logLevel, string log)
        {
            if (!IsLoggerConfigured)
            {
                return;
            }

            if (logLevel.Equals(LogLevel.DEBUG))
            {
                _logger.LogWriteLine("DEBUG- " + log);
            }
            else if (logLevel.Equals(LogLevel.ERROR))
            {
                _logger.LogWriteLine("ERROR- " + log);
            }
            else if (logLevel.Equals(LogLevel.FATAL))
            {
                _logger.LogWriteLine("FATAL- " + log);

            }
            else if (logLevel.Equals(LogLevel.INFO))
            {
                _logger.LogWriteLine("INFO- " + log);
            }
            else if (logLevel.Equals(LogLevel.WARN))
            {
                _logger.LogWriteLine("WARN- " + log);
            }
            else if (logLevel.Equals(LogLevel.MESSAGE))
            {
                _logger.LogWriteLine(log);
            }
        }
Beispiel #27
0
        /// <summary>
        /// Returns true if OrgApacheSlingDistributionAgentImplForwardDistributionAgentFactoProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of OrgApacheSlingDistributionAgentImplForwardDistributionAgentFactoProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrgApacheSlingDistributionAgentImplForwardDistributionAgentFactoProperties other)
        {
            if (other is null) return false;
            if (ReferenceEquals(this, other)) return true;

            return 
                (
                    Name == other.Name ||
                    Name != null &&
                    Name.Equals(other.Name)
                ) && 
                (
                    Title == other.Title ||
                    Title != null &&
                    Title.Equals(other.Title)
                ) && 
                (
                    Details == other.Details ||
                    Details != null &&
                    Details.Equals(other.Details)
                ) && 
                (
                    Enabled == other.Enabled ||
                    Enabled != null &&
                    Enabled.Equals(other.Enabled)
                ) && 
                (
                    ServiceName == other.ServiceName ||
                    ServiceName != null &&
                    ServiceName.Equals(other.ServiceName)
                ) && 
                (
                    LogLevel == other.LogLevel ||
                    LogLevel != null &&
                    LogLevel.Equals(other.LogLevel)
                ) && 
                (
                    AllowedRoots == other.AllowedRoots ||
                    AllowedRoots != null &&
                    AllowedRoots.Equals(other.AllowedRoots)
                ) && 
                (
                    QueueProcessingEnabled == other.QueueProcessingEnabled ||
                    QueueProcessingEnabled != null &&
                    QueueProcessingEnabled.Equals(other.QueueProcessingEnabled)
                ) && 
                (
                    PackageImporterEndpoints == other.PackageImporterEndpoints ||
                    PackageImporterEndpoints != null &&
                    PackageImporterEndpoints.Equals(other.PackageImporterEndpoints)
                ) && 
                (
                    PassiveQueues == other.PassiveQueues ||
                    PassiveQueues != null &&
                    PassiveQueues.Equals(other.PassiveQueues)
                ) && 
                (
                    PriorityQueues == other.PriorityQueues ||
                    PriorityQueues != null &&
                    PriorityQueues.Equals(other.PriorityQueues)
                ) && 
                (
                    RetryStrategy == other.RetryStrategy ||
                    RetryStrategy != null &&
                    RetryStrategy.Equals(other.RetryStrategy)
                ) && 
                (
                    RetryAttempts == other.RetryAttempts ||
                    RetryAttempts != null &&
                    RetryAttempts.Equals(other.RetryAttempts)
                ) && 
                (
                    RequestAuthorizationStrategyTarget == other.RequestAuthorizationStrategyTarget ||
                    RequestAuthorizationStrategyTarget != null &&
                    RequestAuthorizationStrategyTarget.Equals(other.RequestAuthorizationStrategyTarget)
                ) && 
                (
                    TransportSecretProviderTarget == other.TransportSecretProviderTarget ||
                    TransportSecretProviderTarget != null &&
                    TransportSecretProviderTarget.Equals(other.TransportSecretProviderTarget)
                ) && 
                (
                    PackageBuilderTarget == other.PackageBuilderTarget ||
                    PackageBuilderTarget != null &&
                    PackageBuilderTarget.Equals(other.PackageBuilderTarget)
                ) && 
                (
                    TriggersTarget == other.TriggersTarget ||
                    TriggersTarget != null &&
                    TriggersTarget.Equals(other.TriggersTarget)
                ) && 
                (
                    QueueProvider == other.QueueProvider ||
                    QueueProvider != null &&
                    QueueProvider.Equals(other.QueueProvider)
                ) && 
                (
                    AsyncDelivery == other.AsyncDelivery ||
                    AsyncDelivery != null &&
                    AsyncDelivery.Equals(other.AsyncDelivery)
                ) && 
                (
                    HttpConnTimeout == other.HttpConnTimeout ||
                    HttpConnTimeout != null &&
                    HttpConnTimeout.Equals(other.HttpConnTimeout)
                );
        }
Beispiel #28
0
		/**
		 * Logs the exception to the appropriate log level if the exception is annotated with
		 * <code>@RestrictedLevel</code>. Otherwise log normally.
		 * @param log the logger
		 * @param logLevel the desired log level
		 * @param message the error message
		 * @param t the exception
		 */
		private static void Log (ILog log, LogLevel logLevel, object message, Exception ex)
		{
			string theMessage = BuildExceptionMessage(Convert.ToString(message), ex);
			if (logLevel.Equals(LogLevel.Fatal))
			{
				log.Fatal(theMessage, ex != null ? ex : null);
			}
			else if (logLevel.Equals(LogLevel.Error))
			{
				log.Error(theMessage, ex != null ? ex : null);
			}
			else if (logLevel.Equals(LogLevel.Warn))
			{
				log.Warn(theMessage, ex != null ? ex : null);
			}
			else if (logLevel.Equals(LogLevel.Info))
			{
				log.Info(theMessage, ex != null ? ex : null);
			}
			else if (logLevel.Equals(LogLevel.Debug))
			{
				log.Debug(theMessage, ex != null ? ex : null);
			}
			else if (logLevel.Equals(LogLevel.Trace))
			{
				//log.Trace(theMessage, ex != null ? ex : null);
				log.Debug(theMessage, ex != null ? ex : null);
			}
		}
Beispiel #29
0
        public void Log(LogLevel level, string msgStr, string trace = null)
        {
            var msgAll = msgStr + trace;

            if (OnLoging != null)
            {
                OnLoging(new LogEventModel
                {
                    LogLevel = level,
                    Message  = msgAll
                }, new EventArgs());
            }

            try
            {
                this.BeginInvoke(new EventHandler(delegate
                {
                    try
                    {
                        foreach (var msg in Split(msgAll, 70))
                        {
                            var levelStr = GetDescription(level);
                            if (level.Equals(LogLevel.ERROR))
                            {
                                logList.Items.Add(new DuiHtmlLabel
                                {
                                    Text     = string.Format("&nbsp;&nbsp; <label color='red'>[{0:yyyy-MM-dd HH:mm:ss} {1}]--------{2} </label>", DateTime.Now, levelStr, msg),
                                    AutoSize = true
                                });
                            }
                            else if (level.Equals(LogLevel.WARN))
                            {
                                logList.Items.Add(new DuiHtmlLabel
                                {
                                    Text     = string.Format("&nbsp;&nbsp; <label color='blue'>[{0:yyyy-MM-dd HH:mm:ss} {1}]--------{2} </label>", DateTime.Now, levelStr, msg),
                                    AutoSize = true
                                });
                            }
                            else
                            {
                                logList.Items.Add(new DuiHtmlLabel
                                {
                                    Text     = string.Format("&nbsp;&nbsp; [{0:yyyy-MM-dd HH:mm:ss} {1}]--------{2}", DateTime.Now, levelStr, msg),
                                    AutoSize = true
                                });
                            }
                        }

                        SetTimeout(100, () =>
                        {
                            logList.Value = 1;
                        });
                    }
                    catch (Exception)
                    {
                        logList.Items.Add(new DuiTextBox()
                        {
                            Text  = msgAll,
                            Width = 800
                        });
                    }
                }));
            }
            catch (Exception)
            {
            }
        }
Beispiel #30
0
        /// <summary>
        /// Logs information and writes it to the console
        /// </summary>
        /// <param name="message">The message to log</param>
        /// <param name="level">LogLevel value, gets compared to the configured logLevel variable</param>
        public void Log(object message, LogLevel level)
        {
            //set thread context properties
            SetContext();
            foreach (var log in logs) {
                switch (level) {
                    case LogLevel.Trace:
                        //log4net has no Trace so Trace and Debug are the same
                        log.Debug(message);
                        break;
                    case LogLevel.Debug:
                        log.Debug(message);
                        break;
                    case LogLevel.Info:
                        log.Info(message);
                        break;
                    case LogLevel.Warn:
                        log.Warn(message);
                        break;
                    case LogLevel.Error:
                        log.Error(message);
                        break;
                    case LogLevel.Critical:
                        log.Fatal(message);
                        break;
                }
            }

            //errors are special - they are exceptions that don't stop the program but we want to write them to a database
            //table
            if (level.Equals(LogLevel.Error) && errorLogDB != null && dataUtils != null) {
                string headers = "Agent: " + Config.AgentType;
                if (Config.Master != null) {
                    headers += " Master: " + Config.Master;
                    headers += " DB: " + Config.MasterDB;
                } else if (Config.Slave != null) {
                    headers += " Slave: " + Config.Slave;
                    headers += " DB: " + Config.SlaveDB;
                } else {
                    headers += " Relay: " + Config.RelayServer;
                    headers += " DB: " + Config.RelayDB;
                }

                dataUtils.LogError(message.ToString(), headers);
            }
        }
Beispiel #31
0
        /// <summary>
        ///   Returns a <see cref="System.String" /> that represents this configuration. Usable as Connection String.
        /// </summary>
        /// <returns> A <see cref="System.String" /> that represents this instance. </returns>
        public override string ToString()
        {
            var builder = new StringBuilder();

            builder.Append("Servers=");
            builder.Append(string.Join(",", Nodes));
            builder.Append(";");

            if (Port != DefaultPort)
            {
                builder.Append("Port=");
                builder.Append(Port);
                builder.Append(";");
            }

            if (Username != null)
            {
                builder.Append("User="******";");
            }

            if (Password != null)
            {
                builder.Append("Password="******";");
            }

            if (!CqlVersion.Equals(DefaultCqlVersion))
            {
                builder.Append("CqlVersion=");
                builder.Append(CqlVersion);
                builder.Append(";");
            }

            if (!DiscoveryScope.Equals(DefaultDiscoveryScope))
            {
                builder.Append("DiscoveryScope=");
                builder.Append(DiscoveryScope);
                builder.Append(";");
            }

            if (!ConnectionStrategy.Equals(DefaultConnectionStrategy))
            {
                builder.Append("ConnectionStrategy=");
                builder.Append(ConnectionStrategy);
                builder.Append(";");
            }

            if (!NewConnectionTreshold.Equals(DefaultNewConnectionTreshold))
            {
                builder.Append("NewConnectionTreshold=");
                builder.Append(NewConnectionTreshold);
                builder.Append(";");
            }

            if (!MaxDownTime.Equals(DefaultMaxDownTime))
            {
                builder.Append("MaxDownTime=");
                builder.Append(MaxDownTime);
                builder.Append(";");
            }

            if (!MinDownTime.Equals(DefaultMinDownTime))
            {
                builder.Append("MinDownTime=");
                builder.Append(MinDownTime);
                builder.Append(";");
            }

            if (MaxConnections > 0)
            {
                builder.Append("MaxConnections=");
                builder.Append(MaxConnections);
                builder.Append(";");
            }

            if (!MaxConnectionsPerNode.Equals(DefaultMaxConnectionsPerNode))
            {
                builder.Append("MaxConnectionsPerNode=");
                builder.Append(MaxConnectionsPerNode);
                builder.Append(";");
            }

            if (MaxConcurrentQueries > 0)
            {
                builder.Append("MaxConcurrentQueries=");
                builder.Append(MaxConcurrentQueries);
                builder.Append(";");
            }

            if (MaxConnectionIdleTime != DefaultMaxConnectionIdleTime)
            {
                builder.Append("MaxConnectionIdleTime=");
                builder.Append(MaxConnectionIdleTime.TotalSeconds);
                builder.Append(";");
            }

            if (MaxQueryRetries != DefaultMaxQueryRetries)
            {
                builder.Append("MaxQueryRetries=");
                builder.Append(MaxQueryRetries);
                builder.Append(";");
            }

            if (UseBuffering != DefaultUseBuffering)
            {
                builder.Append("UseBuffering=");
                builder.Append(UseBuffering);
                builder.Append(";");
            }

            if (AllowCompression != DefaultAllowCompression)
            {
                builder.Append("AllowCompression=");
                builder.Append(AllowCompression);
                builder.Append(";");
            }

            if (AllowCompression && CompressionTreshold != DefaultCompressionTreshold)
            {
                builder.Append("CompressionTreshold=");
                builder.Append(CompressionTreshold);
                builder.Append(";");
            }

            if (!LoggerFactory.Equals(DefaultLoggerFactory, StringComparison.InvariantCultureIgnoreCase))
            {
                builder.Append("LoggerFactory=");
                builder.Append(LoggerFactory);
                builder.Append(";");
            }

            if (!LogLevel.Equals(DefaultLogLevel))
            {
                builder.Append("LogLevel=");
                builder.Append(LogLevel);
                builder.Append(";");
            }

            return(builder.ToString());
        }