Example #1
0
        public void MetricsTest()
        {
            var data = new[]
            {
                new LogzMetricsData
                {
                    Metrics = new LogzMetrics {
                        DetailCount = 1
                    },
                    Dimensions = new LogzDimensions
                    {
                        Name = "Name", Details = "Test Detail", HostName = "HostName",
                        BasePortalUrlName = "BasePortalUrlName", DecisionsVersion = "DecisionsVersion"
                    }
                },
                new LogzMetricsData
                {
                    Metrics = new LogzMetrics {
                        DetailCount = 2
                    },
                    Dimensions = new LogzDimensions {
                        Name = "Name", Details = "metrics message"
                    }
                }
            };
            var res = LogzApi.SendMetrics(credential, data);

            Assert.IsTrue(res);
        }
 protected override void SendData(LogzMetricsData[] metrics)
 {
     if (!LogzApi.SendMetrics(CredentialHelper.Credentials, metrics))
     {
         LogConstants.SYSTEM.Error("Decisions.Monitoring.Logz.io failed to send Metrics");
     }
 }
Example #3
0
        public void LogTest()
        {
            Log.LogToFile = false;

            var data = new[]
            {
                new LogData(DateTime.Now, LogSeverity.Debug, "category", "message")
                {
                    SessionID = "sessionid", Activity = "activity",
                    Exception = new InvalidOperationException("TestException")
                },
                new LogData(DateTime.Now, LogSeverity.Fatal | LogSeverity.Info, "category", "message")
                {
                    SessionID = "sessionid", Activity = "activity"
                },
                new LogData(DateTime.Now, LogSeverity.All, "category", "message")
                {
                    SessionID = "sessionid", Activity = "activity"
                },
                new LogData(DateTime.Now, LogSeverity.None, "category", "message")
                {
                    SessionID = "sessionid", Activity = "activity"
                },
                new LogData()
            };

            LogzLogData[] logzData = data.Select(it => new LogzLogData(it, "PortalUrlName", "hostName")).ToArray();
            var           res      = LogzApi.SendLog(credential, logzData);

            Assert.IsTrue(res);
        }
 protected override void SendData(LogzLogData[] logs)
 {
     LogzApi.SendLog(CredentialHelper.Credentials, logs); // We ignore log error because we cannot write log-error to log
 }