コード例 #1
0
        public async Task LogAsync()
        {
            var eventTarget = EventTarget.ForProject("pid");
            var options     = ErrorReportingOptions.CreateInstance();
            var consumer    = new FakeConsumer();

            IContextExceptionLogger logger = new ErrorReportingContextExceptionLogger(
                consumer, eventTarget, _serviceContext, options, null);
            await logger.LogAsync(CreateException(), new FakeContextWrapper());

            ValidateSingleEntry(consumer, _method, _uri, _userAgent, options, eventTarget);
        }
コード例 #2
0
        public void Log_Simple()
        {
            var eventTarget = EventTarget.ForProject("pid");
            var options     = ErrorReportingOptions.CreateInstance();
            var consumer    = new FakeConsumer();

            IContextExceptionLogger logger = new ErrorReportingContextExceptionLogger(
                consumer, eventTarget, _serviceContext, options, null);

            logger.Log(CreateException(), new EmptyContextWrapper());

            ValidateSingleEntry(consumer, "", "", "", options, eventTarget);
        }
コード例 #3
0
        public void ForProject()
        {
            var eventTarget = EventTarget.ForProject(_projectId);

            Assert.Equal(EventTargetKind.Logging, eventTarget.Kind);
            Assert.Equal(_projectId, eventTarget.ProjectId);
            Assert.NotNull(eventTarget.LogTarget);
            Assert.Equal(LogTargetKind.Project, eventTarget.LogTarget.Kind);
            Assert.Equal(_projectId, eventTarget.LogTarget.ProjectId);

#pragma warning disable CS0618 // Type or member is obsolete
            Assert.Null(eventTarget.LoggingClient);
            Assert.Null(eventTarget.LogName);
            Assert.Null(eventTarget.MonitoredResource);
#pragma warning restore CS0618 // Type or member is obsolete
        }