PostSharp Diagnostics

The no-brainer instrumentation toolbox for .NET.

  • Add logging to thousands of methods within minutes.
  • Works with 10+ popular .NET logging frameworks.
  • Faster than hand-written code.
  • Measure execution time and get performance warnings.
  • Highly customizable.

Developer Edition

FREE

Stops logging after 24 hours.

Standard Edition

$595 for 5 users

Unlimited.

Comprehensive logs

Performance First

Faster than hand-written code – Code instrumented with PostSharp is typically faster than code instrumented by hand. We've benchmarked.

Enable/disable at run time – Logging can be turned on and off dynamically at run time using a simple API. When logging is disabled, the cost overhead is as low as 0 thanks to the JIT compiler optimizations.

GC-friendly – PostSharp does not allocate memory unless your logging framework requires it. For instance, with ETW, striclty no managed memory is allocated.

No impact on source code

  • Target thousands of methods with a single line of code.
  • Filter based on the name or namespace using wildcards or regular expressions.
  • Filter based on the type or method visibility or another qualifier.
  • Create more complex filters with System.Reflection.
  • Remove from release builds with #if DEBUG.
// Log all public methods of the Contoso.BusinessLayer namespace.
[assembly: Log(AttributePriority = 1, 
               AttributeTargetTypes = "Contoso.BusinessLayer.*"
               AttributeTargetMemberAttributes = MulticastAttributes.Protected | 
                       MulticastAttributes.Internal | MulticastAttributes.Public)]
                    
// Exclude property getters.
[assembly: Log(AttributePriority = 2, AttributeExclude = true, 
               AttributeTargetMembers = "get_*" )]

// In DEBUG build, add logging to the registry API.                    
#if DEBUG
[assembly: Log( AttributePriority = 3, AttributeTargetAssemblies = "mscorlib"
                AttributeTargetTypes = "Microsoft.Win32.Registry*" )]
#endif

Super Detailed

You can choose to include the following pieces of data into your logs:

  • Full method and type name
  • Parameter name, type and value
  • this value
  • Execution time
  • Async state machine id
  • Field changes
  • Source code file name and line number
  • Works on any method – not just public ones

Highly Customizable

Parameter Formatters – Customize how parameter values are rendered, even with external types.

Enable/Disable Features – Most features can be enabled or disabled manually so you only get what you actually need. Don't need parameter names? No problem.

Override Anything – You can replace almost any formatting logic with your own.

Custom Logging Framework – You can build an adapter for any logging framework, including semantic ones.

Logging Frameworks

PostSharp provides out-of-the-box integration with the following products:

  • Log4Net
  • NLog
  • Common.Logging
  • Serilog
  • EventSource (ETW)
  • System.Diagnostics
  • Console.WriteLine
  • Microsoft.Extensions.Logging (.NET Core)
  • Enterprise Library
  • Application Insights
  • Loupe
  • Any other framework (custom back-end)
Break free from routine TODAY and start delivering more in less time.