| RE: [aus-dotnet] Whidbey Beta2 and the "Go Live" |
- From: Sean Malloy
- Subject: RE: [aus-dotnet] Whidbey Beta2 and the "Go Live"
- Date: Thu, 02 Dec 2004 12:07:25 +1100
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
> I'd like to submit a feature request if allowed! Not sure of the exact
> place to ask for this, but hopefully you'll let us know.
> It's probably too late to ask for this, and it'll probably
> require a change
> to the CLR (read as - so it'll probably never happen!)...
> Anyway, here goes...
>
> Problem: Logging/Instrumentation etc...
> When attempting to write performance conscious logging code,
> for example,
> using the Logging App. Block and the EIF, the 1 liner's etc.
Rather than having unecessarily complex features tacked-on to the
language/runtime, can't you just create a few new objects?
interface IMessageProvider
{
string Message { get; }
}
// implemented as a struct because its only a temp obj and we're not keeping
references to it. Keep it on the stack.
struct SerializableMessageProvider : IMessageProvider
{
private SerializableObject obj;
public SerializableMessageProvider(SerializableObject obj) { this.obj =
obj; }
public string Message { get { return obj.SerializeToXML(); } }
}
public function Raise (myEventSource as EventSource, eventPublishLogLevel
as Integer, msgToLog as IMessageProvider)
If (eventPublishLogLevel > applicationLogLevel) And
EventSource.Application.IsEnabledForType(GetType(TraceMessageEvent)) Then
'do the actual logging work...
actualLog(myEventSource, eventPublishLogLevel,
msgToLog.Message)
End If
end function
Well. thats what I'd do.. Then just create implementations for various
objects you need to "lazily" invoke messages on
TraceMessageEvent.Raise(source, level, new
SerializableMessageProvider(obj)); // SerializeToXML() isn't calle dunless
its actually needed.
Sorry about the hodge podge mizing of VB and C#, I don't know all the syntax
for VB. You could also think up better names too.
_________________
You are a part of the Australian "dotnet" mailing list.
To unsubscribe send "unsubscribe dotnet" or to re-subscribe send "subscribe dotnet Your Name" in the body of the email to: imailsrv@xxxxxxxxxxx
List managed by: http://www.stanski.com
(Click here for more information on the aus-dotnet mailling list)
- Prev by Date: RE: [aus-dotnet] Whidbey Beta2 and the "Go Live"
- Next by Date: RE: [aus-dotnet] Whidbey Beta2 and the "Go Live"
- Previous by thread: RE: [aus-dotnet] Whidbey Beta2 and the "Go Live"
- Next by thread: RE: [aus-dotnet] Whidbey Beta2 and the "Go Live"
- Index(es):
