99using StackExchange . Redis ;
1010using System . Threading . Tasks ;
1111using System . Collections . Generic ;
12+ using Microsoft . Extensions . Logging ;
1213
1314namespace CSharpSample
1415{
@@ -28,9 +29,9 @@ public static class RedisSample
2829 public static async Task < IActionResult > RetrieveIntegerValue (
2930 [ HttpTrigger ( AuthorizationLevel . Function , "get" , Route = null ) ] HttpRequest req ,
3031 [ RedisDatabase ( Connection = "%redis_connectionstring%" ) ] IDatabase db ,
31- TraceWriter log )
32+ ILogger log )
3233 {
33- log . Info ( "C# HTTP trigger function processed a request." ) ;
34+ log . LogInformation ( "C# HTTP trigger function processed a request." ) ;
3435
3536 var key = req . Query [ "key" ] . ToString ( ) ;
3637 if ( string . IsNullOrEmpty ( key ) )
@@ -55,7 +56,7 @@ public static async Task<IActionResult> RetrieveIntegerValue(
5556 public static async Task < IActionResult > RetrieveList (
5657 [ HttpTrigger ( AuthorizationLevel . Function , "get" , Route = null ) ] HttpRequest req ,
5758 [ RedisDatabase ( Connection = "%redis_connectionstring%" ) ] IDatabase db ,
58- TraceWriter log )
59+ ILogger log )
5960 {
6061 var key = req . Query [ "key" ] . ToString ( ) ;
6162 if ( string . IsNullOrEmpty ( key ) )
@@ -87,7 +88,7 @@ public static async Task<IActionResult> RetrieveList(
8788 public static IActionResult IncrementRedisValue (
8889 [ HttpTrigger ( AuthorizationLevel . Function , "get" , "post" , Route = null ) ] HttpRequest req ,
8990 [ RedisOutput ( Connection = "%redis_connectionstring%" ) ] out RedisOutput redisItem ,
90- TraceWriter log )
91+ ILogger log )
9192 {
9293 redisItem = null ;
9394
@@ -129,9 +130,9 @@ public static IActionResult IncrementRedisValue(
129130 public static IActionResult SetValueInRedis (
130131 [ HttpTrigger ( AuthorizationLevel . Function , "post" , Route = null ) ] HttpRequest req ,
131132 [ RedisOutput ( Connection = "%redis_connectionstring%" , Key = "%redis_setvalueinredis_key%" ) ] out RedisOutput redisItem ,
132- TraceWriter log )
133+ ILogger log )
133134 {
134- log . Info ( "C# HTTP trigger function processed a request." ) ;
135+ log . LogInformation ( "C# HTTP trigger function processed a request." ) ;
135136
136137 string requestBody = new StreamReader ( req . Body ) . ReadToEnd ( ) ;
137138
@@ -155,7 +156,7 @@ public static IActionResult SetValueInRedis(
155156 public static IActionResult AppendToListInRedis (
156157 [ HttpTrigger ( AuthorizationLevel . Function , "get" , "post" , Route = null ) ] HttpRequest req ,
157158 [ RedisOutput ( Connection = "%redis_connectionstring%" , Key = "myList" , Operation = RedisOutputOperation . ListRightPush ) ] out RedisOutput redisItem ,
158- TraceWriter log )
159+ ILogger log )
159160 {
160161 string itemValue = new StreamReader ( req . Body ) . ReadToEnd ( ) ;
161162 if ( string . IsNullOrEmpty ( itemValue ) )
@@ -181,7 +182,7 @@ public static IActionResult AppendToListInRedis(
181182 public static IActionResult InsertToListInRedis (
182183 [ HttpTrigger ( AuthorizationLevel . Function , "get" , "post" , Route = null ) ] HttpRequest req ,
183184 [ RedisOutput ( Connection = "%redis_connectionstring%" , Key = "myList" , Operation = RedisOutputOperation . ListLeftPush ) ] out RedisOutput redisItem ,
184- TraceWriter log )
185+ ILogger log )
185186 {
186187 string itemValue = new StreamReader ( req . Body ) . ReadToEnd ( ) ;
187188 if ( string . IsNullOrEmpty ( itemValue ) )
0 commit comments