Skip to content

Commit 3483c6d

Browse files
committed
README
1 parent e263fb0 commit 3483c6d

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
This example demonstrates how to configure verbosity differently for each request using the XML configuration file [postsharp-logging.config](postsharp-logging.config).
2+
output in the log.
3+
4+
The initialization code is simple:
5+
6+
```cs
7+
AspNetCoreLogging.Initialize();
8+
LoggingServices.DefaultBackend = new ConsoleLoggingBackend();
9+
LoggingServices.DefaultBackend.ConfigureFromXml(XDocument.Load("postsharp-logging.config"));
10+
```
11+
12+
To start the example, do `dotnet run` in this directory.
13+
14+
Then open https://localhost:5001/ with your browser and read the instructions in the home page.
15+
16+
You will see that the home page is logged every 10 seconds but the Privacy page is logged every time.
17+

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ or you can download them on [GitHub](https://www.github.com/postsharp/PostSharp.
2626
| [PostSharp.Samples.NormalizeString](Framework/PostSharp.Samples.NormalizeString/) | Trims and lowercases strings before they are assigned to a field or property.
2727
| [PostSharp.Samples.StoredProcedure](Framework/PostSharp.Samples.StoredProcedure/) | Implements something like P-Invoke, but for database stored procedures. |
2828
| **Diagnostics**
29-
| [PostSharp.Samples.Logging.Customization](Diagnostics/PostSharp.Samples.Logging.Customization/) | Shows how to customize PostSharp Logging. |
3029
| [PostSharp.Samples.Logging.Console](Diagnostics/PostSharp.Samples.Logging.Console/) | Demonstrates how to configure PostSharp Logging so that it directs its output to the *system console*. |
30+
| [PostSharp.Samples.Logging.PerRequest](Diagnostics/PostSharp.Samples.Logging.PerRequest/) | Shows how to have different verbosity for each request,
31+
| [PostSharp.Samples.Logging.Customization](Diagnostics/PostSharp.Samples.Logging.Customization/) | Shows how to customize PostSharp Logging. |
3132
| [PostSharp.Samples.Logging.Etw](Diagnostics/PostSharp.Samples.Logging.Etw/) | Demonstrates how to configure PostSharp Logging so that it directs its output to *ETW*. |
3233
| [PostSharp.Samples.Logging.Etw.CustomSource](Diagnostics/PostSharp.Samples.Logging.Etw.CustomSource/) | Demonstrates how use PostSharp Logging with a custom *ETW* source (instead of the predefined one). |
3334
| [PostSharp.Samples.Logging.Log4Net](Diagnostics/PostSharp.Samples.Logging.Log4Net/) | Demonstrates how to configure PostSharp Logging so that it directs its output to *log4net*. |
@@ -37,7 +38,6 @@ or you can download them on [GitHub](https://www.github.com/postsharp/PostSharp.
3738
| [PostSharp.Samples.Logging.CommonLogging](Diagnostics/PostSharp.Samples.Logging.CommonLogging/) | Demonstrates how to configure PostSharp Logging so that it directs its output to *Common.Logging*. |
3839
| [PostSharp.Samples.Logging.CustomBackend.ServiceStack](Diagnostics/PostSharp.Samples.Logging.CustomBackend.ServiceStack/) | Demonstrates how to implement a PostSharp Logging adapter for your custom logging framework. |
3940
| [PostSharp.Samples.Logging.Audit](Diagnostics/PostSharp.Samples.Audit/) | Shows how to append an audit record to a database when a method is invoked. |
40-
| [PostSharp.Samples.Logging.Audit.Extended](Diagnostics/PostSharp.Samples.Audit.Extended/) | Shows how to add custom pieces of information to the audit record. |
4141
| **Distributed Diagnostics with Elastic Search**
4242
| [PostSharp.Samples.Logging.ElasticStack/MicroserviceExample](Diagnostics/PostSharp.Samples.Logging.ElasticStack/MicroserviceExample/) | The server-side service demonstrating correlation of logs of a distributed application with Elastic Search. |
4343
| [PostSharp.Samples.Logging.ElasticStack/ClientExample](Diagnostics/PostSharp.Samples.Logging.ElasticStack/ClientExample/) | The server-side service demonstrating correlation of logs of a distributed application with Elastic Search. |

0 commit comments

Comments
 (0)