PostSharp Logging について

アプリケーションに卓越したログ記録機能を追加

PostSharp Logging (formerly PostSharp Diagnostics) is an instrumentation toolbox for .NET and .NET Core. It allows you to add extensive logging to your application in minutes and direct it to any logging framework. PostSharp Logging is easy to use but still provides all the detail you need, see parameter values, timing, and more. Much faster than hand-written code and fully customizable, you can override every single moving part. PostSharp also provides integration with your existing logging framework.

Super Fast

  • Zero Logging = Zero Cost – If logging is disabled for a given namespace during application start-up, the cost overhead is strictly zero.
  • Enable/disable at run time – Logging can be turned on and off dynamically at run time using a simple API.
  • Minimal memory allocation – PostSharp Logging does not allocate memory until the very last moment.
  • Performance warnings – Set up a warning when the method execution time exceeds a given threshold.

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.
  • Works on any method.

Supported 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.
  • Any other framework (custom back-end).

PostSharp Logging Features

  • Framework
    • Method-level aspects
    • Code validation
  • Common
    • Code Contracts
  • MVVM
    • INotifyPropertyChanged: automatic properties
  • Logging
    • Developer mode (freshly-built apps)
    • Production mode