t.durden
t.durden

Reputation: 178

logging with PostSharp multicastAttribute

I'm trying to implement logging with PostSharp and multicastAttribute. Using the Logging aspect that comes in PostSharp Diagnostics library.

I have a GlboalAspects.cs in the start up project directory. The content is as follows.

`[assembly: PostSharp.Patterns.Diagnostics.LogAttribute(AttributeTargetTypes = "alp_generator.*", AttributeTargetMemberAttributes = PostSharp.Extensibility.MulticastAttributes.NonAbstract )]`

right clickeing my projects and selecting properties, the default namepsace is "alp_generator"

I don't know that "PostSharp.Patterns.Diagnostics.LogAttribute" is correct.

I get no logging at all. If I apply the [Log] Attribute to any method, it logs as expected.

I'd appreciate any ideas in getting this working. Thanks in advance.

BTW, I've gone through PostSharp documentation, and I didn't see anything that helped me get this working.

Upvotes: 0

Views: 130

Answers (1)

Using the project wizard instead of the class wizard does that. It sets up everything and it also creates the GlobalAspects.cs file. If the options offered by the wizard are not sufficient, you can manually edit the GlobalAspects.cs file according to http://doc.postsharp.net/multicast-conceptual.

The wizard is available by right-clicking the Project you want to add logging to > Add > PostSharp policy... > Diagnostics > Add logging.

Upvotes: 1

Related Questions