diff --git a/README.md b/README.md index b5e6545..fc6344f 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ [3]: https://github.com/yarseyah/sentinel#nlogs-nlogviewer-target-configuration [p1]: doc/images/control.png "NLogViewer" -[p2]: doc/images/preview.gif "NLogViewer" -[p3]: doc/images/control2.png "NLogViewer" +[p2]: doc/images/live.gif "NLogViewer" +[p3]: doc/images/colors.png "NLogViewer" [nuget]: https://nuget.org/packages/Sentinel.NlogViewer/ @@ -20,16 +20,9 @@ NlogViewer NlogViewer is a ui control library to visualize NLog logs in your personal application. It is mainly based on [Sentinel][1] and its controls. -![NLogViewer][p2] - -Actually it contains the following controls: - -- `NLogViewer` - -Visual Studio +supported Frameworks: `.NETCoreApp v3.0`, `.NETCoreApp v3.1`, `.NET Framework 4.6.1` -![NLogViewer][p1] -![NLogViewer][p3] +![NLogViewer][p2] ## Quick Start @@ -72,6 +65,60 @@ If you want to customize the `loggingPattern` and `LogLevel`, add the following ``` +## Customize + +### Colors + +Customize `foreground` or `background` of every `logLevel` + +![NLogViewer][p3] + +### Multi targeting + +Use more than one instance of `NLogViewer` to match different `rules`. + +Create 2 `targets` with their own `rules`. + +```xml + + + + + + + + + +``` + +Set `TargetName` property to link them. + +```xml + + +``` + +### Format output (ILogEventInfoResolver) + +To format the output of a `LogEventInfo`, implement a new instance of `ILogEventInfoResolver` and bind it to the `Resolver` you want to customize: + +```csharp +/// +/// Reformat the DateTime +/// +public class FooTimeStampResolver : ILogEventInfoResolver +{ + public string Resolve(LogEventInfo logEventInfo) + { + return logEventInfo.TimeStamp.ToUniversalTime().ToString(); + } +} +``` + +```csharp +NLogViewer1.TimeStampResolver = new FooTimeStampResolver(); +``` + ## Why CacheTarget? There is already a `NLogViewerTarget`, which is used for [Sentinel][1]. See [here][3] diff --git a/doc/images/colors.png b/doc/images/colors.png new file mode 100644 index 0000000..99e5546 Binary files /dev/null and b/doc/images/colors.png differ diff --git a/doc/images/control.png b/doc/images/control.png deleted file mode 100644 index ee7bbeb..0000000 Binary files a/doc/images/control.png and /dev/null differ diff --git a/doc/images/control2.png b/doc/images/control2.png deleted file mode 100644 index f7bbb94..0000000 Binary files a/doc/images/control2.png and /dev/null differ diff --git a/doc/images/live.gif b/doc/images/live.gif new file mode 100644 index 0000000..5174420 Binary files /dev/null and b/doc/images/live.gif differ diff --git a/doc/images/preview.gif b/doc/images/preview.gif deleted file mode 100644 index 06e8cf3..0000000 Binary files a/doc/images/preview.gif and /dev/null differ diff --git a/src/NLogViewer.TestApp/MainWindow.xaml.cs b/src/NLogViewer.TestApp/MainWindow.xaml.cs index c9dfed3..9ab85bf 100644 --- a/src/NLogViewer.TestApp/MainWindow.xaml.cs +++ b/src/NLogViewer.TestApp/MainWindow.xaml.cs @@ -68,6 +68,9 @@ public MainWindow() } } + /// + /// Reformat the DateTime + /// public class FooTimeStampResolver : ILogEventInfoResolver { public string Resolve(LogEventInfo logEventInfo)