Skip to content

Commit 8ff0fd4

Browse files
committed
updating after rename
1 parent 96ca146 commit 8ff0fd4

17 files changed

+30
-37
lines changed

samples/SampleApp/Blob/BlobFunction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static void Run(
1717
[BlobInput("test-samples-input/sample1.txt", Connection = "AzureWebJobsStorage")] string myBlob,
1818
FunctionContext context)
1919
{
20-
var logger = context.Logger;
20+
var logger = context.GetLogger("BlobFunction");
2121
logger.LogInformation($"Triggered Item = {myTriggerItem}");
2222
logger.LogInformation($"Input Item = {myBlob}");
2323

samples/SampleApp/CosmosDB/CosmosDBFunction.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

4-
using System.Collections.Generic;
4+
using System.Collections.Generic;
55
using System.Linq;
66
using Microsoft.Azure.Functions.Worker;
77
using Microsoft.Azure.Functions.Worker.Extensions.Abstractions;
@@ -19,7 +19,7 @@ public static void Run(
1919
LeaseCollectionName = "leases", CreateLeaseCollectionIfNotExists = true)] IReadOnlyList<MyDocument> input,
2020
FunctionContext context)
2121
{
22-
var logger = context.Logger;
22+
var logger = context.GetLogger("CosmosDBFunction");
2323

2424
if (input != null && input.Any())
2525
{

samples/SampleApp/DependencyInjection/DependencyInjectionFunction.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@
66
using Microsoft.Azure.Functions.Worker;
77
using Microsoft.Azure.Functions.Worker.Extensions.Abstractions;
88
using Microsoft.Azure.Functions.Worker.Extensions.Http;
9-
using Microsoft.Azure.Functions.Worker.Pipeline;
109
using Microsoft.Extensions.Logging;
1110

1211
namespace SampleApp
1312
{
1413
public class DependencyInjectionFunction
1514
{
1615
private readonly IHttpResponderService _responderService;
16+
private readonly ILogger<DependencyInjectionFunction> _logger;
1717

18-
public DependencyInjectionFunction(IHttpResponderService responderService)
18+
public DependencyInjectionFunction(IHttpResponderService responderService, ILogger<DependencyInjectionFunction> logger)
1919
{
2020
_responderService = responderService;
21+
_logger = logger;
2122
}
2223

2324
[FunctionName(nameof(DependencyInjectionFunction))]
2425
public HttpResponseData Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestData req,
25-
FunctionContext executionContext)
26+
FunctionContext context)
2627
{
27-
var logger = executionContext.Logger;
28-
logger.LogInformation("message logged");
28+
_logger.LogInformation("message logged");
2929

3030
return _responderService.ProcessRequest(req);
3131
}

samples/SampleApp/EventGrid/EventGridFunction.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

4-
using System.Collections.Generic;
4+
using System.Collections.Generic;
55
using Microsoft.Azure.Functions.Worker;
66
using Microsoft.Azure.Functions.Worker.Extensions.Abstractions;
77
using Microsoft.Azure.Functions.Worker.Extensions.EventGrid;
@@ -15,7 +15,7 @@ public static class EventGridFunction
1515
[EventGridOutput("output", TopicEndpointUri = "MyEventGridTopicUriSetting", TopicKeySetting = "MyEventGridTopicKeySetting")]
1616
public static void Run([EventGridTrigger] MyEventType input, FunctionContext context)
1717
{
18-
var logger = context.Logger;
18+
var logger = context.GetLogger("EventGridFunction");
1919

2020
logger.LogInformation(input.Data.ToString());
2121

samples/SampleApp/EventHubs/EventHubsFunction.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

4-
using System;
4+
using System;
55
using Microsoft.Azure.Functions.Worker;
66
using Microsoft.Azure.Functions.Worker.Extensions.Abstractions;
77
using Microsoft.Azure.Functions.Worker.Extensions.EventHubs;
@@ -16,7 +16,7 @@ public static class EventHubsFunction
1616
public static void Run([EventHubTrigger("src", Connection = "EventHubConnectionAppSetting")] string input,
1717
FunctionContext context)
1818
{
19-
var logger = context.Logger;
19+
var logger = context.GetLogger("EventHubsFunction");
2020

2121
logger.LogInformation(input);
2222

samples/SampleApp/Http/HttpFunction.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using Microsoft.Azure.Functions.Worker;
77
using Microsoft.Azure.Functions.Worker.Extensions.Abstractions;
88
using Microsoft.Azure.Functions.Worker.Extensions.Http;
9-
using Microsoft.Azure.Functions.Worker.Pipeline;
109
using Microsoft.Extensions.Logging;
1110

1211
namespace SampleApp
@@ -17,7 +16,7 @@ public static class HttpFunction
1716
public static HttpResponseData Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequestData req,
1817
FunctionContext executionContext)
1918
{
20-
var logger = executionContext.Logger;
19+
var logger = executionContext.GetLogger("HttpFunction");
2120
logger.LogInformation("message logged");
2221
var response = new HttpResponseData(HttpStatusCode.OK);
2322
var headers = new Dictionary<string, string>();

samples/SampleApp/Kafka/KafkaFunction.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

4-
using System;
4+
using System;
55
using Microsoft.Azure.Functions.Worker;
66
using Microsoft.Azure.Functions.Worker.Extensions.Abstractions;
77
using Microsoft.Azure.Functions.Worker.Extensions.Kafka;
@@ -17,7 +17,7 @@ public static void Run([KafkaTrigger("LocalBroker", "stringTopicTenPartitions",
1717
ConsumerGroup = "$Default", AuthenticationMode = BrokerAuthenticationMode.Plain)] string input,
1818
FunctionContext context)
1919
{
20-
var logger = context.Logger;
20+
var logger = context.GetLogger("KafkaFunction");
2121

2222
logger.LogInformation(input);
2323

samples/SampleApp/Queue/QueueFunction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static class QueueFunction
1515
public static void Run([QueueTrigger("functionstesting2", Connection = "AzureWebJobsStorage")] Book myQueueItem,
1616
FunctionContext context)
1717
{
18-
var logger = context.Logger;
18+
var logger = context.GetLogger("QueueFunction");
1919
logger.LogInformation($"Book name = {myQueueItem.Name}");
2020

2121
// Queue Output

samples/SampleApp/RabbitMQ/RabbitMQFunction.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

4-
using System;
4+
using System;
55
using Microsoft.Azure.Functions.Worker;
66
using Microsoft.Azure.Functions.Worker.Extensions.Abstractions;
77
using Microsoft.Azure.Functions.Worker.Extensions.RabbitMQ;
@@ -16,7 +16,7 @@ public static class RabbitMQFunction
1616
public static void Run([RabbitMQTrigger("queue", ConnectionStringSetting = "rabbitMQConnectionAppSetting")] string item,
1717
FunctionContext context)
1818
{
19-
var logger = context.Logger;
19+
var logger = context.GetLogger("RabbitMQFunction");
2020

2121
logger.LogInformation(item);
2222

samples/SampleApp/ServiceBus/ServiceBusFunction.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

4-
using System;
4+
using System;
55
using Microsoft.Azure.Functions.Worker;
66
using Microsoft.Azure.Functions.Worker.Extensions.Abstractions;
77
using Microsoft.Azure.Functions.Worker.Extensions.ServiceBus;
@@ -16,7 +16,7 @@ public static class ServiceBusFunction
1616
public static void Run([ServiceBusTrigger("queue", Connection = "ServiceBusConnection")] string item,
1717
FunctionContext context)
1818
{
19-
var logger = context.Logger;
19+
var logger = context.GetLogger("ServiceBusFunction");
2020

2121
logger.LogInformation(item);
2222

samples/SampleApp/SignalR/SignalRFunction.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

4-
using System;
4+
using System;
55
using Microsoft.Azure.Functions.Worker;
66
using Microsoft.Azure.Functions.Worker.Extensions.Abstractions;
77
using Microsoft.Azure.Functions.Worker.Extensions.SignalRService;
@@ -18,7 +18,7 @@ public static class SignalRFunction
1818
[SignalRConnectionInfoInput(HubName = "chat")] MyConnectionInfo connectionInfo,
1919
FunctionContext context)
2020
{
21-
var logger = context.Logger;
21+
var logger = context.GetLogger("SignalRFunction");
2222

2323
logger.LogInformation(item);
2424
logger.LogInformation($"Connection URL = {connectionInfo.Url}");

samples/SampleApp/Table/TableFunction.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

4-
using System;
4+
using System;
55
using Microsoft.Azure.Functions.Worker;
66
using Microsoft.Azure.Functions.Worker.Extensions.Abstractions;
77
using Microsoft.Azure.Functions.Worker.Extensions.Storage;
@@ -18,7 +18,7 @@ public static void Run([QueueTrigger("table-items")] string input,
1818
[TableInput("MyTable", "MyPartition", "{queueTrigger}")] JObject tableItem,
1919
FunctionContext context)
2020
{
21-
var logger = context.Logger;
21+
var logger = context.GetLogger("TableFunction");
2222

2323
logger.LogInformation(tableItem.ToString());
2424

samples/SampleApp/Timer/TimerFunction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static class TimerFunction
1515
public static void Run([TimerTrigger("0 */5 * * * *")] MyInfo timerInfo,
1616
FunctionContext context)
1717
{
18-
var logger = context.Logger;
18+
var logger = context.GetLogger("TimerFunction");
1919
logger.LogInformation($"Function Ran. Next timer schedule = {timerInfo.ScheduleStatus.Next}");
2020
}
2121
}

samples/SampleApp/Warmup/Warmup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static class Warmup
1313
[FunctionName("Warmup")]
1414
public static void Run([WarmupTrigger] object _, FunctionContext context)
1515
{
16-
var logger = context.Logger;
16+
var logger = context.GetLogger("Warmup");
1717

1818
logger.LogInformation("Function App instance is now warm!");
1919
}

src/DotNetWorker/Context/FunctionContext.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System;
55
using System.Collections.Generic;
66
using Microsoft.Azure.Functions.Worker.Context;
7-
using Microsoft.Azure.Functions.Worker.Logging;
87

98
namespace Microsoft.Azure.Functions.Worker
109
{
@@ -33,11 +32,6 @@ public abstract class FunctionContext
3332
/// </summary>
3433
public abstract object? InvocationResult { get; set; }
3534

36-
/// <summary>
37-
/// GEts or sets an <see cref="InvocationLogger"/> scoped to the current invocation.
38-
/// </summary>
39-
public abstract InvocationLogger? Logger { get; set; }
40-
4135
// TODO: Double-check previous projects for layout of FunctionInvocation, Bindings,
4236
/// <summary>
4337
/// Gets or sets a key/value collection with results for defined output bindings.

src/DotNetWorker/Context/FunctionExecutionContextExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ namespace Microsoft.Azure.Functions.Worker
88
{
99
public static class FunctionExecutionContextExtensions
1010
{
11-
public static ILogger<T> GetLogger<T>(this FunctionExecutionContext context)
11+
public static ILogger<T> GetLogger<T>(this FunctionContext context)
1212
{
1313
return context.InstanceServices.GetService<ILogger<T>>();
1414
}
1515

16-
public static ILogger GetLogger(this FunctionExecutionContext context, string categoryName)
16+
public static ILogger GetLogger(this FunctionContext context, string categoryName)
1717
{
1818
return context.InstanceServices
1919
.GetService<ILoggerFactory>()

src/DotNetWorker/Converters/FunctionContextConverter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ public bool TryConvert(ConverterContext context, out object? target)
77
target = null;
88

99
// Special handling for the context.
10-
if (context.Parameter.Type == typeof(FunctionExecutionContext))
10+
if (context.Parameter.Type == typeof(FunctionContext))
1111
{
12-
target = context.ExecutionContext;
12+
target = context.FunctionContext;
1313
return true;
1414
}
1515

0 commit comments

Comments
 (0)