![](/img/trans.png)
[英]How can I convert date values from the multiple different types that are string to datetime with one method?
[英]Can I replace SLAB one-method-per-event with types?
SLAB的示例通常如下所示:
MyCompanyEventSource.Log.ScalingRequestSubmitted(
request.RoleName,
request.InstanceCount,
context.RuleName,
context.CurrentInstanceCount);
我不喜歡每次添加新事件類型時都必須編輯MyCompanyEventSource
。 我也不喜歡記錄器只能靜態使用。 我寧願有這樣的事情:
_logger.Log(new ScalingRequestSubmittedEvent(request, context));
我知道我可以自己滾動日志記錄,但是在我完全撤銷SLAB之前,我想知道自己是否不公平。
沒有辦法做這樣的事情
_logger.Log(new ScalingRequestSubmittedEvent(request, context));
而且,當您想添加新類型的事件,更改信息級別或關鍵字時,必須隨時更改記錄器。
編寫自己的EventSource包裝器是實現所需功能的唯一方法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.