|
|
|
Community Member
|
|
Hi, I have just started researching PostSharp to use on our current project for logging and am a bit confused. It seems you can perform logging with either PostSharp Laos or Log4PostSharp. What is the difference and which one would be the best to use? Maybe I am missing that Log4Post uses Laos but I havent seen this. Thanks for replies Noel
|
|
|
|
|
Michal Dabrowski
Community Member
|
|
Hi,
the difference is in performance. Log4PostSharp injects just logging statements (and injects them directly), while the code injected by Laos creates some auxiliary objects, not related to logging but supporting Laos features. In other words: Log4PostSharp has no overhead (your program works as fast as it would if you typed all the logging statements by hand) while Laos has overhead that you will suffer from (the more methods the logging aspect is applied to the more you will feel it - and it can get *very* noticeable).
The overhead of Laos is negligible for most aspects - but not for logging IMO. This is because logging aspects are usually applied very "broadly", i.e. to most (if not all) methods in the code.
|
|
|
|
|
Community Member
|
|
Michal, Thanks for reply, hope to start using Log4PostSharp next week. Had a look at the demo code and the methods take in simple types. I was wondering is there a way to log the properties of an object been passed in as a parameter. e.g. a customer object is passed into a method and I want to log the customer id and name. Thanks again Noel
|
|
|
|