Reputation: 4013
Using the free version of Postsharp, I added a logging aspect (using the toolkit, didn't code it myself). Later I changed my mind and wanted to log only upon entering a function, and not on leaving.
Where can this be configured? Couldn't find it anywhere.
Thanks!
Upvotes: 3
Views: 618
Reputation: 4072
Diagnostics configuration is stored in solution (.pssln) or project level configuration file (.psproj). These files may not contain required configuration tags or even they may be missing by default.
You can open the configuration wizard from smart tag over any method without [Log] attribute. The configuration you are interested in is on the first page (Logging Level). Note that there is "New logging profile..." at the bottom of this page - you can have multiple configurations within one application.
If you change diagnostics configuration then pssln file is created after completing the wizard and it should contain something like this:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.postsharp.org/1.0/configuration" xmlns:d="clr-namespace:PostSharp.Patterns.Diagnostics;assembly:PostSharp.Patterns.Diagnostics" xmlns:p="http://schemas.postsharp.org/1.0/configuration" xmlns:p1="http://schemas.postsharp.org/1.0/configuration">
<Property Name="LoggingEnabled" Value="{has-plugin('PostSharp.Patterns.Diagnostics')}" Deferred="true" />
<d:LoggingProfiles p:Condition="{$LoggingEnabled}">
<d:LoggingProfile Name="Default" OnExceptionLevel="None" OnSuccessLevel="None" />
</d:LoggingProfiles>
</Project>
The interesting tag is d:LoggingProfile with it's attributes OnExceptionLevel and OnSuccessLevel. You can add this configuration file manually as well.
Upvotes: 2