0
我正在实施一个跟踪机制。现在我想知道的是实现这种机制的最佳方式是什么(我的意思是架构)。首先,我想创建这样一个类:如何在.net中执行跟踪
class Tracer {
public void NewEventRegistered(etc) {...} //this is the method I use to send this class the events I want to register
event newEventRegistered(..) //this is the event the user is going to use to catch all the events in the application that have been sent to NewEventRegistered method.
}
但后来我看到有一个TraceListener类,它可以让我实现Write和WriteLine方法。最大的缺点是这两种方法只允许字符串作为参数,我希望能够发送比字符串更多的信息。我该怎么办?也许我的第一个ideia是最好的?
编辑:我知道有很多像PostSharp这样的跟踪机制,所以我只是为了学习的目的而这样做!