- Azure Serverless Computing Cookbook
- Praveen Kumar Sreeram
- 196字
- 2021-07-02 20:23:10
Customizing the log file name using IBinder interface
- Navigate to the code editor of the RegisterUser function.
- Remove the TextWriter object and replace it with the variable binder of type IBinder. This is the new signature of the Run method with the changes highlighted:
public static void Run(HttpRequestMessage req,
TraceWriter log,
CloudTable objUserProfileTable,
out string objUserProfileQueueItem,
out Mail message,
IBinder binder,
out SMSMessage objsmsmessage
)
- Let's grab the data of the new record that's inserted into the Azure Table storage service. We will be using the GUID (RowKey) of the newly created record in the Table storage. Make the changes highlighted in the following piece of code:
TableResult objTableResult =
objUserProfileTable.Execute(objTblOperationInsert);
UserProfile objInsertedUser =
(UserProfile)objTableResult.Result;
- As we have removed the TextWriter object, the line of code outputBlob.WriteLine(emailContent); will no longer work. Let's replace it with the following piece of code:
using (var emailLogBloboutput = binder.Bind<TextWriter>(new
BlobAttribute($"userregistrationemaillogs/
{objInsertedUser.RowKey}.log")))
{
emailLogBloboutput.WriteLine(emailContent);
}
- Let's run a test using the same request payload that we have used in the previous recipes.
- You will see the email log file that is created using the RowKey of the new record stored in the Azure Table storage, as shown in the following screenshot:

推薦閱讀
- Visual C++程序設(shè)計(jì)學(xué)習(xí)筆記
- Practical UX Design
- PHP程序設(shè)計(jì)(慕課版)
- SQL for Data Analytics
- 利用Python進(jìn)行數(shù)據(jù)分析(原書第3版)
- 微信小程序全棧開發(fā)技術(shù)與實(shí)戰(zhàn)(微課版)
- Mastering Python Design Patterns
- Go語言入門經(jīng)典
- Visual Basic語言程序設(shè)計(jì)基礎(chǔ)(第3版)
- Python物理建模初學(xué)者指南(第2版)
- Xamarin Cross-Platform Development Cookbook
- Jakarta EE Cookbook
- C#網(wǎng)絡(luò)編程高級篇之網(wǎng)頁游戲輔助程序設(shè)計(jì)
- 測試工程師Python開發(fā)實(shí)戰(zhàn)
- micro:bit軟件指南