Пример #1
0
        /// <summary>
        /// Calling result on the task forces it to be synchronous
        /// </summary>
        public ResponseCode SendPlainMessageSynchronous()
        {
            var logEvent = new LogglyEvent();

            logEvent.Data.Add("message", "Synchronous message at {0} using {1}", DateTime.Now, LogglyConfig.Instance.Transport.LogTransport);
            var r = _loggly.Log(logEvent).Result;

            return(r.Code);
        }
Пример #2
0
        public static void Log(Exception e)
        {
            if (_client == null)
            {
                _client = GetClient();
            }

            var logEvent = new LogglyEvent();

            logEvent.Data.Add("version", GetExecutingAssemblyVersion());
            logEvent.Data.Add("exception", e);
            _client.Log(logEvent);
        }
Пример #3
0
        protected override void Write(LogEventInfo logEvent)
        {
            var logglyEvent = ConvertToLogglyEvent(logEvent);

            if (logglyEvent != null)
            {
                var task = _client.Log(logglyEvent).ContinueWith(_receivedLogResponse);
                if (Interlocked.Increment(ref _pendingTaskCount) >= TaskPendingLimit)
                {
                    task.Wait();
                    _pendingTaskCount = 0;
                }
            }
        }
Пример #4
0
        public static void Log(string message, Exception exception = null,
                               object additional = null, string language = null)
        {
            if (_client == null)
            {
                _client = GetClient();
            }

            var logEvent = new LogglyEvent();

            logEvent.Data.Add("version", GetExecutingAssemblyVersion());
            logEvent.Data.Add("message", message);

            if (exception != null)
            {
                logEvent.Data.Add("exception", exception);
            }

            if (additional != null)
            {
                logEvent.Data.Add("additional", additional);
            }

            _client.Log(logEvent);
        }
Пример #5
0
        public App()
        {
            var LogEvent = new LogglyEvent();

            LogEvent.Data.Add("App Start detected", "{0}: Welcome new user!", DateTime.Now);
            fLoggly.Log(LogEvent);
        }
Пример #6
0
        public void MonitorLog(string pLogFilePath)
        {
            Messenger.Default.Send <GenericMessage>(new GenericMessage()
            {
                Message = "Validating Log File"
            });
            if (File.Exists(pLogFilePath))
            {
                var LogEvent = new LogglyEvent();
                LogEvent.Data.Add("Monitor Log", "{0}: valid Logfile={1}", DateTime.Now, pLogFilePath);
                fLoggly.Log(LogEvent);

                Properties.Settings.Default.LogFile = pLogFilePath;
                Properties.Settings.Default.Save();
                var DirectoryPath = Path.GetDirectoryName(pLogFilePath);
                var FileName      = Path.GetFileName(pLogFilePath);


                Messenger.Default.Send <GenericMessage>(new GenericMessage()
                {
                    Message = "Starting Initial Log Parse"
                });
                onChanged(this, new FileSystemEventArgs(WatcherChangeTypes.All, DirectoryPath, FileName));
                Messenger.Default.Send <GenericMessage>(new GenericMessage()
                {
                    Message = "Finished. Monitoring now..."
                });

                fFileWatcher.Path                = DirectoryPath;
                fFileWatcher.Filter              = FileName;
                fFileWatcher.NotifyFilter        = NotifyFilters.LastWrite;
                fFileWatcher.Changed            += new FileSystemEventHandler(onChanged);
                fFileWatcher.EnableRaisingEvents = true;
            }
            else
            {
                Messenger.Default.Send <GenericMessage>(new GenericMessage()
                {
                    Message = "I don't think you entered a valid Log File, try again?"
                });
                var LogEvent = new LogglyEvent();
                LogEvent.Data.Add("Monitor Log", "{0}: Invalid Logfile={1}", DateTime.Now, pLogFilePath);
                fLoggly.Log(LogEvent);
            }
        }
        public IActionResult Get()
        {
            Log.Information("ConfigurationOptions:{@configurationOptions}", _configurationOptions.ToString());

            _logglyEvent.Data.Add("ClientAppSettings:", "{0}", _configurationOptions.ToString());
            _logglyClient.Log(_logglyEvent);

            return(Ok(new
            {
                _configurationOptions.OpenIdConnectConfiguration,
                _configurationOptions.LogglyClientConfiguration,
            }));
        }
Пример #8
0
 public static void Log(LogglyEvent logglyEvent)
 {
     Client.Log(logglyEvent);
 }
Пример #9
0
        public void GetDKPInformation()
        {
            fGuildRoster.Clear();
            string html = string.Empty;
            string url  = @"http://modestman.club/dkp";

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

            request.AutomaticDecompression = DecompressionMethods.GZip;

            try
            {
                try
                {
                    using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                        using (Stream stream = response.GetResponseStream())
                            using (StreamReader reader = new StreamReader(stream))
                            {
                                html = reader.ReadToEnd();
                                Properties.Settings.Default.DkpInfo = html;
                                Properties.Settings.Default.Save();
                                Messenger.Default.Send <GenericMessage>(new GenericMessage()
                                {
                                    Message = "Was able to get the latest DKP successfully"
                                });
                            }
                }
                catch (Exception)
                {
                    Messenger.Default.Send <GenericMessage>(new GenericMessage()
                    {
                        Message = "Was NOT able to get the latest DKP, using last known data on file"
                    });
                    var LogEvent = new LogglyEvent();
                    LogEvent.Data.Add("Fetching DKP", "{0}: Error fetching latest DKP, site must be down", DateTime.Now);
                    fLoggly.Log(LogEvent);
                    html = Properties.Settings.Default.DkpInfo;
                }
                var htmlDoc = new HtmlDocument();
                htmlDoc.LoadHtml(html);

                HtmlNodeCollection playerList = htmlDoc.DocumentNode.SelectNodes("//table[@class=\"table fullwidth trcheckboxclick hptt colorswitch scrollable-x\"]/tr");

                foreach (HtmlNode player in playerList)
                {
                    if (player.ChildNodes.Count >= 9 && !player.ChildNodes[3].InnerText.Trim().Equals("Name"))
                    {
                        MadeMan vMadeMan = new MadeMan()
                        {
                            Name = player.ChildNodes[3].InnerText,
                            Rank = player.ChildNodes[5].InnerText,
                            DKP  = player.ChildNodes[7].InnerText,
                            RA   = player.ChildNodes[9].InnerText,
                        };
                        fGuildRoster.Add(vMadeMan);
                    }
                }
            }
            catch (Exception e)
            {
                //Typically bad practice to catch all, but f**k it
                Messenger.Default.Send <GenericMessage>(new GenericMessage()
                {
                    Message = "Critical Error in DKPService"
                });
                var LogEvent = new LogglyEvent();
                LogEvent.Data.Add("Catch All DKP", "{0}:{1}", DateTime.Now, e);
                fLoggly.Log(LogEvent);
            }
        }