This commit is contained in:
Brett Samblanet 2017-05-02 14:09:30 -07:00
Родитель b1c2a9dd97
Коммит 5d55eb1614
52 изменённых файлов: 93 добавлений и 46 удалений

Просмотреть файл

@ -3,7 +3,7 @@
using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.Logging;
namespace SampleHost

Просмотреть файл

@ -8,6 +8,7 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Host.Protocols;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.Logging;
namespace Microsoft.Azure.WebJobs.Host.Bindings

Просмотреть файл

@ -7,8 +7,8 @@ using System.IO;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Host.Protocols;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.Logging;
namespace Microsoft.Azure.WebJobs.Host.Bindings

Просмотреть файл

@ -16,6 +16,7 @@ using Microsoft.Azure.WebJobs.Host.Bindings;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Host.Protocols;
using Microsoft.Azure.WebJobs.Host.Timers;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.Logging;
namespace Microsoft.Azure.WebJobs.Host.Executors

Просмотреть файл

@ -26,6 +26,7 @@ using Microsoft.Azure.WebJobs.Host.Storage.Queue;
using Microsoft.Azure.WebJobs.Host.Tables;
using Microsoft.Azure.WebJobs.Host.Timers;
using Microsoft.Azure.WebJobs.Host.Triggers;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.Logging;
namespace Microsoft.Azure.WebJobs.Host.Executors

Просмотреть файл

@ -69,4 +69,5 @@
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.Azure.WebJobs.Host.JobHostQueuesConfiguration.#MaxPollingIntervalInt")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.Azure.WebJobs.Host.JobHostQueuesConfiguration.#MaxPollingIntervalInt")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "AddBindingRule", Scope = "member", Target = "Microsoft.Azure.WebJobs.Host.Config.ExtensionConfigContext.#AddBindingRule`1()")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.Azure.WebJobs.Host.Loggers.FunctionResultAggregatorFactory.#Create(System.Int32,System.TimeSpan,Microsoft.Extensions.Logging.ILoggerFactory)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.Azure.WebJobs.Host.Loggers.FunctionResultAggregatorFactory.#Create(System.Int32,System.TimeSpan,Microsoft.Extensions.Logging.ILoggerFactory)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.Azure.WebJobs.Logging.FunctionResultAggregatorFactory.#Create(System.Int32,System.TimeSpan,Microsoft.Extensions.Logging.ILoggerFactory)")]

Просмотреть файл

@ -15,6 +15,7 @@ using Microsoft.Azure.WebJobs.Host.Listeners;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Host.Protocols;
using Microsoft.Azure.WebJobs.Host.Triggers;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.Logging;
namespace Microsoft.Azure.WebJobs.Host.Indexers

Просмотреть файл

@ -12,8 +12,8 @@ using Microsoft.Azure.WebJobs.Host;
using Microsoft.Azure.WebJobs.Host.Executors;
using Microsoft.Azure.WebJobs.Host.Indexers;
using Microsoft.Azure.WebJobs.Host.Listeners;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Host.Protocols;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.Logging;
using Microsoft.WindowsAzure.Storage;

Просмотреть файл

@ -13,6 +13,7 @@ using Microsoft.Azure.WebJobs.Host.Indexers;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Host.Queues;
using Microsoft.Azure.WebJobs.Host.Timers;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json.Linq;

Просмотреть файл

@ -6,6 +6,7 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Host.Protocols;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.Logging;
namespace Microsoft.Azure.WebJobs.Host.Listeners

Просмотреть файл

@ -10,7 +10,7 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs.Host.Bindings.Path;
using Microsoft.Azure.WebJobs.Host.Indexers;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.Logging;
namespace Microsoft.Azure.WebJobs.Host.Listeners

Просмотреть файл

@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace Microsoft.Azure.WebJobs.Host.Loggers
namespace Microsoft.Azure.WebJobs.Logging
{
internal class FunctionResultAggregate
{

Просмотреть файл

@ -7,9 +7,10 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Extensions.Logging;
namespace Microsoft.Azure.WebJobs.Host.Loggers
namespace Microsoft.Azure.WebJobs.Logging
{
internal class FunctionResultAggregator : IAsyncCollector<FunctionInstanceLogEntry>, IDisposable
{

Просмотреть файл

@ -4,7 +4,7 @@
using System;
using Microsoft.Extensions.Logging;
namespace Microsoft.Azure.WebJobs.Host
namespace Microsoft.Azure.WebJobs.Logging
{
/// <summary>
/// Configuration options for function result aggregation.

Просмотреть файл

@ -2,9 +2,10 @@
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Extensions.Logging;
namespace Microsoft.Azure.WebJobs.Host.Loggers
namespace Microsoft.Azure.WebJobs.Logging
{
internal class FunctionResultAggregatorFactory : IFunctionResultAggregatorFactory
{

Просмотреть файл

@ -2,9 +2,10 @@
// Licensed under the MIT License. See License.txt in the project root for license information.
using System;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Extensions.Logging;
namespace Microsoft.Azure.WebJobs.Host.Loggers
namespace Microsoft.Azure.WebJobs.Logging
{
internal interface IFunctionResultAggregatorFactory
{

Просмотреть файл

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
namespace Microsoft.Azure.WebJobs.Host.Loggers
namespace Microsoft.Azure.WebJobs.Logging
{
/// <summary>
/// Constant values for log categories.

Просмотреть файл

@ -3,7 +3,7 @@
using Microsoft.Extensions.Logging;
namespace Microsoft.Azure.WebJobs.Host.Loggers
namespace Microsoft.Azure.WebJobs.Logging
{
/// <summary>
/// Keys used by the <see cref="ILogger"/> infrastructure.
@ -11,90 +11,112 @@ namespace Microsoft.Azure.WebJobs.Host.Loggers
public static class LoggingKeys
{
/// <summary>
/// Gets the name of the key used to store the full name of the function.
/// </summary>
public const string FullName = "FullName";
/// <summary>
/// Gets the name of the key used to store the name of the function.
/// </summary>
public const string Name = "Name";
/// <summary>
/// Gets the name of the key used to store the number of invocations.
/// </summary>
public const string Count = "Count";
/// <summary>
/// Gets the name of the key used to store the success count.
/// </summary>
public const string Successes = "Successes";
/// <summary>
/// Gets the name of the key used to store the failure count.
/// </summary>
public const string Failures = "Failures";
/// <summary>
/// Gets the name of the key used to store the success rate.
/// </summary>
public const string SuccessRate = "SuccessRate";
/// <summary>
/// Gets the name of the key used to store the average duration in milliseconds.
/// </summary>
public const string AverageDuration = "AvgDurationMs";
/// <summary>
/// Gets the name of the key used to store the maximum duration in milliseconds.
/// </summary>
public const string MaxDuration = "MaxDurationMs";
/// <summary>
/// Gets the name of the key used to store the minimum duration in milliseconds.
/// </summary>
public const string MinDuration = "MinDurationMs";
/// <summary>
/// Gets the name of the key used to store the timestamp.
/// </summary>
public const string Timestamp = "Timestamp";
/// <summary>
/// Gets the name of the key used to store the function invocation id.
/// </summary>
public const string InvocationId = "InvocationId";
/// <summary>
/// Gets the name of the key used to store the trigger reason.
/// </summary>
public const string TriggerReason = "TriggerReason";
/// <summary>
/// Gets the name of the key used to store the start time.
/// </summary>
public const string StartTime = "StartTime";
/// <summary>
/// Gets the name of the key used to store the end time.
/// </summary>
public const string EndTime = "EndTime";
/// <summary>
/// Gets the name of the key used to store the duration of the function invocation.
/// </summary>
public const string Duration = "Duration";
/// <summary>
/// Gets the name of the key used to store whether the function succeeded.
/// </summary>
public const string Succeeded = "Succeeded";
/// <summary>
/// Gets the name of the key used to store the formatted message.
/// </summary>
public const string FormattedMessage = "FormattedMessage";
/// <summary>
/// Gets the name of the key used to store the category of the log message.
/// </summary>
public const string CategoryName = "Category";
/// <summary>
/// Gets the name of the key used to store the HTTP method.
/// </summary>
public const string HttpMethod = "HttpMethod";
/// <summary>
/// Gets the prefix for custom properties.
/// </summary>
public const string CustomPropertyPrefix = "prop__";
/// <summary>
/// Gets the prefix for parameters.
/// </summary>
public const string ParameterPrefix = "param__";
/// <summary>
/// Gets the name of the key used to store the original format of the log message.
/// </summary>
public const string OriginalFormat = "{OriginalFormat}";
}

Просмотреть файл

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
namespace Microsoft.Azure.WebJobs.Host.Loggers
namespace Microsoft.Azure.WebJobs.Logging
{
/// <summary>
/// A collection of constants used for logging scope keys.

Просмотреть файл

@ -8,7 +8,7 @@ using System.Linq;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Internal;
namespace Microsoft.Azure.WebJobs.Host.Loggers
namespace Microsoft.Azure.WebJobs.Logging
{
/// <summary>
/// The <see cref="FormattedLogValues"/> object created by the framework <see cref="ILogger"/> extensions

Просмотреть файл

@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Logging;
namespace Microsoft.Azure.WebJobs.Host.Loggers
namespace Microsoft.Azure.WebJobs.Logging
{
/// <summary>
/// Provides a filter for use with an <see cref="ILogger"/>.

Просмотреть файл

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using Microsoft.Azure.WebJobs.Host.Executors;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Logging;
namespace Microsoft.Extensions.Logging
{

Просмотреть файл

@ -4,9 +4,10 @@
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;
namespace Microsoft.Azure.WebJobs.Host.Loggers
namespace Microsoft.Azure.WebJobs.Logging
{
/// <summary>
/// A <see cref="TraceWriter"/> wrapper around an <see cref="ILogger"/>.

Просмотреть файл

@ -3,6 +3,7 @@
using System;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.Logging;
using Microsoft.WindowsAzure.Storage.Queue;

Просмотреть файл

@ -8,6 +8,7 @@ using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.Logging;
namespace Microsoft.Azure.WebJobs.Host.Listeners

Просмотреть файл

@ -19,6 +19,7 @@ using Microsoft.Azure.WebJobs.Host.Protocols;
using Microsoft.Azure.WebJobs.Host.Storage;
using Microsoft.Azure.WebJobs.Host.Storage.Blob;
using Microsoft.Azure.WebJobs.Host.Timers;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.Logging;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;

Просмотреть файл

@ -507,7 +507,7 @@
<Compile Include="Loggers\Logger\Constants\ScopeKeys.cs" />
<Compile Include="Loggers\Logger\LoggerExtensions.cs" />
<Compile Include="Loggers\Logger\LogCategoryFilter.cs" />
<Compile Include="Loggers\Logger\LogValueCollection.cs" />
<Compile Include="Loggers\Logger\FormattedLogValuesCollection.cs" />
<Compile Include="Loggers\Logger\TraceWriter\LoggerTraceWriter.cs" />
<Compile Include="Loggers\TraceEventExtensions.cs" />
<Compile Include="Exceptions\FunctionException.cs" />

Просмотреть файл

@ -8,9 +8,10 @@ using System.Net.Http;
using System.Web;
using Microsoft.ApplicationInsights;
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Extensions.Logging;
namespace Microsoft.Azure.WebJobs.Host.Loggers
namespace Microsoft.Azure.WebJobs.Logging.ApplicationInsights
{
internal class ApplicationInsightsLogger : ILogger
{

Просмотреть файл

@ -4,7 +4,8 @@
using System;
using Microsoft.ApplicationInsights;
using Microsoft.ApplicationInsights.WindowsServer.Channel.Implementation;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Azure.WebJobs.Logging.ApplicationInsights;
namespace Microsoft.Extensions.Logging
{

Просмотреть файл

@ -6,7 +6,7 @@ using System.Threading;
using Microsoft.ApplicationInsights;
using Microsoft.Extensions.Logging;
namespace Microsoft.Azure.WebJobs.Host.Loggers
namespace Microsoft.Azure.WebJobs.Logging.ApplicationInsights
{
internal class ApplicationInsightsLoggerProvider : ILoggerProvider
{

Просмотреть файл

@ -5,7 +5,7 @@ using System;
using System.Collections.Generic;
using System.Threading;
namespace Microsoft.Azure.WebJobs.Host.Loggers
namespace Microsoft.Azure.WebJobs.Logging.ApplicationInsights
{
internal class DictionaryLoggerScope
{

Просмотреть файл

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
namespace Microsoft.Azure.WebJobs.Host.Loggers
namespace Microsoft.Azure.WebJobs.Logging.ApplicationInsights
{
internal static class ApplicationInsightsScopeKeys
{

Просмотреть файл

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
namespace Microsoft.Azure.WebJobs.Host.Loggers
namespace Microsoft.Azure.WebJobs.Logging.ApplicationInsights
{
internal static class LoggingConstants
{

Просмотреть файл

@ -13,7 +13,7 @@ using Microsoft.ApplicationInsights.WindowsServer;
using Microsoft.ApplicationInsights.WindowsServer.Channel.Implementation;
using Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel;
namespace Microsoft.Azure.WebJobs.Host.Loggers
namespace Microsoft.Azure.WebJobs.Logging.ApplicationInsights
{
/// <summary>
/// Creates a <see cref="TelemetryClient"/> for use by the <see cref="ApplicationInsightsLogger"/>.

Просмотреть файл

@ -11,8 +11,8 @@
// "In Suppression File".
// You do not need to add suppressions to this file manually.
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.Extensions.Logging.ApplicationInsightsLoggerExtensions.#AddApplicationInsights(Microsoft.Extensions.Logging.ILoggerFactory,System.String,System.Func`3<System.String,Microsoft.Extensions.Logging.LogLevel,System.Boolean>)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.Extensions.Logging.ApplicationInsightsLoggerExtensions.#AddApplicationInsights(Microsoft.Extensions.Logging.ILoggerFactory,Microsoft.Azure.WebJobs.Host.Loggers.ITelemetryClientFactory,System.Func`3<System.String,Microsoft.Extensions.Logging.LogLevel,System.Boolean>)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.Azure.WebJobs.Host.Loggers.DefaultTelemetryClientFactory.#InitializeConfiguration()")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", MessageId = "_perfModule", Scope = "member", Target = "Microsoft.Azure.WebJobs.Host.Loggers.DefaultTelemetryClientFactory.#Dispose(System.Boolean)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", MessageId = "_quickPulseModule", Scope = "member", Target = "Microsoft.Azure.WebJobs.Host.Loggers.DefaultTelemetryClientFactory.#Dispose(System.Boolean)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.Extensions.Logging.ApplicationInsightsLoggerExtensions.#AddApplicationInsights(Microsoft.Extensions.Logging.ILoggerFactory,Microsoft.Azure.WebJobs.Logging.ApplicationInsights.ITelemetryClientFactory,System.Func`3<System.String,Microsoft.Extensions.Logging.LogLevel,System.Boolean>)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.Azure.WebJobs.Logging.ApplicationInsights.DefaultTelemetryClientFactory.#InitializeConfiguration()")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", MessageId = "_perfModule", Scope = "member", Target = "Microsoft.Azure.WebJobs.Logging.ApplicationInsights.DefaultTelemetryClientFactory.#Dispose(System.Boolean)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", MessageId = "_quickPulseModule", Scope = "member", Target = "Microsoft.Azure.WebJobs.Logging.ApplicationInsights.DefaultTelemetryClientFactory.#Dispose(System.Boolean)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "Microsoft.Extensions.Logging.ApplicationInsightsLoggerExtensions.#AddApplicationInsights(Microsoft.Extensions.Logging.ILoggerFactory,System.String,System.Func`3<System.String,Microsoft.Extensions.Logging.LogLevel,System.Boolean>)")]

Просмотреть файл

@ -4,7 +4,7 @@
using System;
using Microsoft.ApplicationInsights;
namespace Microsoft.Azure.WebJobs.Host.Loggers
namespace Microsoft.Azure.WebJobs.Logging.ApplicationInsights
{
/// <summary>
/// Interface for creating <see cref="TelemetryClient"/> instances.

Просмотреть файл

@ -6,8 +6,9 @@ using System.Collections.Generic;
using Microsoft.ApplicationInsights.Channel;
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.Azure.WebJobs.Host.Loggers;
namespace Microsoft.Azure.WebJobs.Host.Loggers
namespace Microsoft.Azure.WebJobs.Logging.ApplicationInsights
{
internal class WebJobsTelemetryInitializer : ITelemetryInitializer
{

Просмотреть файл

@ -17,6 +17,7 @@ using Microsoft.Azure.WebJobs.Host.Protocols;
using Microsoft.Azure.WebJobs.Host.Queues;
using Microsoft.Azure.WebJobs.Host.TestCommon;
using Microsoft.Azure.WebJobs.Host.Timers;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.Logging;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;

Просмотреть файл

@ -7,6 +7,7 @@ using Microsoft.Azure.WebJobs.Host.Executors;
using Microsoft.Azure.WebJobs.Host.FunctionalTests.TestDoubles;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Host.TestCommon;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.Logging;
using Moq;
using Xunit;

Просмотреть файл

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.Logging;
namespace Microsoft.Azure.WebJobs.Host.TestCommon

Просмотреть файл

@ -11,7 +11,6 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs.Host.Bindings;
using Microsoft.Azure.WebJobs.Host.Indexers;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Host.Protocols;
using Microsoft.Azure.WebJobs.Host.TestCommon;
using Microsoft.Azure.WebJobs.Host.Triggers;
@ -171,7 +170,7 @@ namespace Microsoft.Azure.WebJobs.Host.UnitTests.Indexers
Assert.Equal(expectedMessage, traceWarning.Message);
// Validate Logger
var logger = loggerProvider.CreatedLoggers.Single(l => l.Category == LogCategories.Startup);
var logger = loggerProvider.CreatedLoggers.Single(l => l.Category == Logging.LogCategories.Startup);
var loggerWarning = logger.LogMessages.Single();
Assert.Equal(LogLevel.Warning, loggerWarning.Level);
Assert.Equal(expectedMessage, loggerWarning.FormattedMessage);
@ -436,7 +435,7 @@ namespace Microsoft.Azure.WebJobs.Host.UnitTests.Indexers
{
}
private class TestIndexCollector: IFunctionIndexCollector
private class TestIndexCollector : IFunctionIndexCollector
{
public List<FunctionDescriptor> Functions = new List<FunctionDescriptor>();

Просмотреть файл

@ -11,7 +11,6 @@ using System.Threading.Tasks;
using Microsoft.Azure.WebJobs.Host.Executors;
using Microsoft.Azure.WebJobs.Host.Indexers;
using Microsoft.Azure.WebJobs.Host.Listeners;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Host.Protocols;
using Microsoft.Azure.WebJobs.Host.TestCommon;
using Microsoft.Extensions.Logging;
@ -76,7 +75,7 @@ namespace Microsoft.Azure.WebJobs.Host.UnitTests.Listeners
// Validate Logger
var logMessage = loggerProvider.CreatedLoggers.Single().LogMessages.Single();
Assert.Equal(LogLevel.Information, logMessage.Level);
Assert.Equal(LogCategories.Startup, logMessage.Category);
Assert.Equal(Logging.LogCategories.Startup, logMessage.Category);
Assert.Equal(expectedMessage, logMessage.FormattedMessage);
Environment.SetEnvironmentVariable("EnvironmentSettingTrue", null);

Просмотреть файл

@ -2,7 +2,7 @@
// Licensed under the MIT License. See License.txt in the project root for license information.
using Microsoft.ApplicationInsights;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Logging.ApplicationInsights;
using Moq;
using Xunit;

Просмотреть файл

@ -14,6 +14,8 @@ using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.Azure.WebJobs.Host.Executors;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Host.Protocols;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Azure.WebJobs.Logging.ApplicationInsights;
using Microsoft.Extensions.Logging;
using Moq;
using Xunit;

Просмотреть файл

@ -5,7 +5,7 @@
using System.Linq;
using Microsoft.ApplicationInsights.WindowsServer;
using Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Logging.ApplicationInsights;
using Xunit;
namespace Microsoft.Azure.WebJobs.Host.UnitTests.Loggers

Просмотреть файл

@ -3,7 +3,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Logging;
using Xunit;
namespace Microsoft.Azure.WebJobs.Host.UnitTests.Loggers

Просмотреть файл

@ -3,6 +3,7 @@
using System;
using Microsoft.Azure.WebJobs.Logging;
using Xunit;
namespace Microsoft.Azure.WebJobs.Host.UnitTests.Loggers

Просмотреть файл

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.Logging;
using Moq;
using Xunit;

Просмотреть файл

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.Logging;
using Xunit;

Просмотреть файл

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.Logging;
using Moq;
using Xunit;
@ -19,7 +20,7 @@ namespace Microsoft.Azure.WebJobs.Host.UnitTests.Loggers
private string _triggerReason = "new queue message";
private string _functionShortName = "TestFunction";
private string _functionFullName = "Functions.TestFunction";
private IDictionary<string, string> _arguments;
private IDictionary<string, string> _arguments;
public LoggerExtensionsTests()
{

Просмотреть файл

@ -5,8 +5,8 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Azure.WebJobs.Logging.ApplicationInsights;
using Xunit;
namespace Microsoft.Azure.WebJobs.Host.UnitTests

Просмотреть файл

@ -9,17 +9,17 @@ using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs.Host.Executors;
using Microsoft.Azure.WebJobs.Host.Loggers;
using Microsoft.Azure.WebJobs.Host.Protocols;
using Microsoft.Azure.WebJobs.Host.Storage;
using Microsoft.Azure.WebJobs.Host.Storage.Blob;
using Microsoft.Azure.WebJobs.Host.TestCommon;
using Microsoft.Azure.WebJobs.Host.Timers;
using Microsoft.Azure.WebJobs.Logging;
using Microsoft.Extensions.Logging;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
using Moq;
using Xunit;
using Microsoft.Azure.WebJobs.Host.Protocols;
namespace Microsoft.Azure.WebJobs.Host.UnitTests.Singleton
{
@ -82,7 +82,7 @@ namespace Microsoft.Azure.WebJobs.Host.UnitTests.Singleton
_singletonConfig.LockAcquisitionTimeout = TimeSpan.FromMilliseconds(200);
_nameResolver = new TestNameResolver();
ILoggerFactory loggerFactory = new LoggerFactory();
// We want to see all logs, so set the default level to Trace.
LogCategoryFilter filter = new LogCategoryFilter { DefaultLevel = Extensions.Logging.LogLevel.Trace };
@ -420,7 +420,8 @@ namespace Microsoft.Azure.WebJobs.Host.UnitTests.Singleton
NotSupportedException exception = Assert.Throws<NotSupportedException>(() =>
{
SingletonManager.GetFunctionSingletonOrNull(new FunctionDescriptor() {
SingletonManager.GetFunctionSingletonOrNull(new FunctionDescriptor()
{
SingletonAttributes = method.GetCustomAttributes<SingletonAttribute>()
}, isTriggered: true);
});