public void Log_WritesMetric_IgnoresOtherLogs()
        {
            var metrics = new TestMetricsLogger();
            var logger  = new UserLogMetricsLogger(LogCategories.CreateFunctionCategory(_functionName), metrics, _scopeProvider);

            // function executions will include this scope
            using (CreateFunctionScope(logger))
            {
                logger.LogInformation("Message");
            }

            Assert.Empty(metrics.LoggedEvents);
        }
        public void Log_WritesMetric_ForUserLogs_WithoutFunctionName()
        {
            var metrics = new TestMetricsLogger();
            var logger  = new UserLogMetricsLogger(_functionCategory, metrics, _scopeProvider);

            // If for some reason the scope doesn't exist, we still want this to suceed, but
            // without a function name.
            logger.LogInformation("Message");

            var    expectedEvent = MetricsEventManager.GetAggregateKey(MetricEventNames.FunctionUserLog);
            string eventName     = metrics.LoggedEvents.Single();

            Assert.Equal(expectedEvent, eventName);
        }
        public void Log_WritesMetric_ForUserLogs()
        {
            var metrics = new TestMetricsLogger();
            var logger  = new UserLogMetricsLogger(_functionCategory, metrics, _scopeProvider);

            // function executions will include this scope
            using (CreateFunctionScope(logger))
            {
                logger.LogInformation("Message");
            }

            var    expectedEvent = MetricsEventManager.GetAggregateKey(MetricEventNames.FunctionUserLog, _functionName);
            string eventName     = metrics.LoggedEvents.Single();

            Assert.Equal(expectedEvent, eventName);
        }