├── .gitattributes
├── .github
├── dependabot.yml
└── workflows
│ ├── commit.yml
│ ├── pre-release.yml
│ └── release.yml
├── .gitignore
├── Directory.build.props
├── GitVersion.yml
├── LICENSE.md
├── NLogViewer.sln
├── README.md
├── createBranch.ps1
├── doc
└── images
│ ├── colors.png
│ ├── newtask.gif
│ ├── openpopup.gif
│ └── overview.gif
└── src
├── NLogViewer.TestApp
├── App.config
├── App.xaml
├── App.xaml.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── NLogViewer.TestApp.csproj
├── TestPopup.xaml
├── TestPopup.xaml.cs
├── nlog.config
└── nuget.config
└── NLogViewer
├── ActionCommand.cs
├── Extensions
└── DependencyObjectExtensions.cs
├── Helper
├── AutoSizedGridView.cs
├── ListViewLayoutManager
│ ├── ConverterGridViewColumn.cs
│ ├── FixedColumn.cs
│ ├── ImageGridViewColumn.cs
│ ├── LayoutColumn.cs
│ ├── ListViewLayoutManager.cs
│ ├── ProportionalColumn.cs
│ └── RangeColumn.cs
└── PredicateBuilder.cs
├── Images
├── Glyphs
│ ├── SortDownArrow.png
│ └── SortUpArrow.png
├── Large
│ ├── Add.png
│ ├── Context.png
│ ├── Debug.png
│ ├── DebugSource.png
│ ├── Error.png
│ ├── Exception.png
│ ├── Exit.png
│ ├── Export.png
│ ├── Fatal.png
│ ├── Info.png
│ ├── Network.png
│ ├── Open.png
│ ├── Save.png
│ ├── Settings.png
│ ├── Thread.png
│ ├── Trace.png
│ ├── Unknown.png
│ └── Warning.png
├── Medium
│ ├── Add.png
│ ├── Debug.png
│ ├── Error.png
│ ├── Exception.png
│ ├── Exit.png
│ ├── Export.png
│ ├── Fatal.png
│ ├── Info.png
│ ├── Network.png
│ ├── Open.png
│ ├── Save.png
│ ├── Settings.png
│ ├── Thread.png
│ ├── Trace.png
│ ├── Unknown.png
│ └── Warning.png
└── Small
│ ├── Add.png
│ ├── Clear.png
│ ├── Clock.png
│ ├── Context.png
│ ├── Debug.png
│ ├── DebugSource.png
│ ├── Error.png
│ ├── Exception.png
│ ├── Exit.png
│ ├── Export.png
│ ├── Fatal.png
│ ├── Info.png
│ ├── Layout.png
│ ├── MonoLightning.png
│ ├── Network.png
│ ├── Open.png
│ ├── Pause.png
│ ├── Save.png
│ ├── ScrollDown.png
│ ├── Settings.png
│ ├── Thread.png
│ ├── Trace.png
│ ├── Unknown.png
│ └── Warning.png
├── NLogViewer.csproj
├── NLogViewer.xaml
├── NLogViewer.xaml.cs
├── Resolver
├── ILogEventInfoResolver.cs
├── IdResolver.cs
├── LoggerNameResolver.cs
├── MessageResolver.cs
└── TimeStampResolver.cs
├── ScrollingHelper.cs
├── Targets
└── CacheTarget.cs
├── XamlMultiValueConverter
└── ILogEventResolverToStringConverter.cs
├── global.json
└── nuget.config
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: nuget
4 | directory: "/"
5 | schedule:
6 | interval: daily
7 | time: "04:00"
8 | open-pull-requests-limit: 10
9 | target-branch: develop
10 | ignore:
11 | - dependency-name: GitVersionTask
12 | versions:
13 | - "> 5.5.0, < 6"
14 | - dependency-name: System.Reactive
15 | versions:
16 | - ">= 5.a, < 6"
17 | - dependency-name: NLog
18 | versions:
19 | - 4.7.7
20 | - 4.7.8
21 |
--------------------------------------------------------------------------------
/.github/workflows/commit.yml:
--------------------------------------------------------------------------------
1 | name: Commit
2 | on:
3 | push:
4 | pull_request:
5 | env:
6 | DOTNET_CLI_TELEMETRY_OPTOUT: true
7 | jobs:
8 | build:
9 | name: Build
10 | runs-on: windows-latest
11 | steps:
12 | - name: Checkout
13 | uses: actions/checkout@v2
14 | with:
15 | fetch-depth: 0
16 | - name: Build solution
17 | run: dotnet build -c Release
18 | - name: Fetch nuget packages
19 | run: |
20 | mkdir -p nuget
21 | copy src\NLogViewer\bin\Release\*.nupkg nuget\
22 | copy src\NLogViewer\bin\Release\*.snupkg nuget\
23 | - name: Upload nuget packages as artifacts
24 | uses: actions/upload-artifact@v4
25 | with:
26 | name: NuGet
27 | path: nuget
28 | if-no-files-found: error
--------------------------------------------------------------------------------
/.github/workflows/pre-release.yml:
--------------------------------------------------------------------------------
1 | name: publish pre-release
2 | on: [workflow_dispatch]
3 | env:
4 | DOTNET_CLI_TELEMETRY_OPTOUT: true
5 | jobs:
6 | build:
7 | name: Build
8 | runs-on: windows-latest
9 | steps:
10 | - name: Checkout
11 | uses: actions/checkout@v2
12 | with:
13 | fetch-depth: 0
14 | ref: ${{ github.ref }}
15 | - name: Build solution
16 | run: dotnet build -c Release
17 | - name: Fetch nuget packages
18 | run: |
19 | mkdir -p nuget
20 | copy src\NLogViewer\bin\Release\*.nupkg nuget\
21 | copy src\NLogViewer\bin\Release\*.snupkg nuget\
22 | - name: Upload nuget packages as artifacts
23 | uses: actions/upload-artifact@v2
24 | with:
25 | name: NuGet
26 | path: nuget
27 | if-no-files-found: error
28 |
29 | publish:
30 | name: Publish
31 | needs: [build]
32 | runs-on: ubuntu-latest
33 | steps:
34 | - name: Download nuget artifacts
35 | uses: actions/download-artifact@v2
36 | with:
37 | name: NuGet
38 | path: nuget
39 | - name: Publish the package to GitHub Packages & nuget.org
40 | run: |
41 | dotnet nuget add source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --name github --username ${{ github.repository_owner }} --password ${{ github.token }} --store-password-in-clear-text
42 | dotnet nuget push ./nuget/*.nupkg --source github
43 | dotnet nuget push ./nuget/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: Release
2 | on:
3 | push:
4 | tags:
5 | - '*'
6 | env:
7 | DOTNET_CLI_TELEMETRY_OPTOUT: true
8 | jobs:
9 | build:
10 | name: Build
11 | runs-on: windows-latest
12 | steps:
13 | - name: Checkout
14 | uses: actions/checkout@v2
15 | with:
16 | fetch-depth: 0
17 | - name: Build solution
18 | run: dotnet build -c Release
19 | - name: Fetch nuget packages
20 | run: |
21 | mkdir -p nuget
22 | copy src\NLogViewer\bin\Release\*.nupkg nuget\
23 | copy src\NLogViewer\bin\Release\*.snupkg nuget\
24 | - name: Upload nuget packages as artifacts
25 | uses: actions/upload-artifact@v2
26 | with:
27 | name: NuGet
28 | path: nuget
29 | if-no-files-found: error
30 | publish:
31 | name: Publish
32 | needs: [build]
33 | runs-on: ubuntu-latest
34 | steps:
35 | - name: Download nuget artifacts
36 | uses: actions/download-artifact@v2
37 | with:
38 | name: NuGet
39 | path: nuget
40 | - name: Get release
41 | id: get_release
42 | uses: bruceadams/get-release@v1.2.2
43 | env:
44 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45 | - name: Upload artifacts to release
46 | uses: actions/github-script@v3
47 | with:
48 | github-token: ${{secrets.GITHUB_TOKEN}}
49 | script: |
50 | const path = require('path');
51 | const fs = require('fs');
52 | const release_id = '${{ steps.get_release.outputs.id }}';
53 | for (let file of await fs.readdirSync('./nuget')) {
54 | console.log('uploadReleaseAsset', file);
55 | await github.repos.uploadReleaseAsset({
56 | owner: context.repo.owner,
57 | repo: context.repo.repo,
58 | release_id: release_id,
59 | name: file,
60 | data: await fs.readFileSync(`./nuget/${file}`)
61 | });
62 | }
63 | - name: Publish the package to GitHub Packages & nuget.org
64 | run: |
65 | dotnet nuget add source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --name github --username ${{ github.repository_owner }} --password ${{ github.token }} --store-password-in-clear-text
66 | dotnet nuget push ./nuget/*.nupkg --source github
67 | dotnet nuget push ./nuget/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Build results
17 | [Dd]ebug/
18 | [Dd]ebugPublic/
19 | [Rr]elease/
20 | [Rr]eleases/
21 | x64/
22 | x86/
23 | [Aa][Rr][Mm]/
24 | [Aa][Rr][Mm]64/
25 | bld/
26 | [Bb]in/
27 | [Oo]bj/
28 | [Ll]og/
29 |
30 | # Visual Studio 2015/2017 cache/options directory
31 | .vs/
32 | # Uncomment if you have tasks that create the project's static files in wwwroot
33 | #wwwroot/
34 |
35 | # Visual Studio 2017 auto generated files
36 | Generated\ Files/
37 |
38 | # MSTest test Results
39 | [Tt]est[Rr]esult*/
40 | [Bb]uild[Ll]og.*
41 |
42 | # NUNIT
43 | *.VisualState.xml
44 | TestResult.xml
45 |
46 | # Build Results of an ATL Project
47 | [Dd]ebugPS/
48 | [Rr]eleasePS/
49 | dlldata.c
50 |
51 | # Benchmark Results
52 | BenchmarkDotNet.Artifacts/
53 |
54 | # .NET Core
55 | project.lock.json
56 | project.fragment.lock.json
57 | artifacts/
58 |
59 | # StyleCop
60 | StyleCopReport.xml
61 |
62 | # Files built by Visual Studio
63 | *_i.c
64 | *_p.c
65 | *_h.h
66 | *.ilk
67 | *.meta
68 | *.obj
69 | *.iobj
70 | *.pch
71 | *.pdb
72 | *.ipdb
73 | *.pgc
74 | *.pgd
75 | *.rsp
76 | *.sbr
77 | *.tlb
78 | *.tli
79 | *.tlh
80 | *.tmp
81 | *.tmp_proj
82 | *_wpftmp.csproj
83 | *.log
84 | *.vspscc
85 | *.vssscc
86 | .builds
87 | *.pidb
88 | *.svclog
89 | *.scc
90 |
91 | # Chutzpah Test files
92 | _Chutzpah*
93 |
94 | # Visual C++ cache files
95 | ipch/
96 | *.aps
97 | *.ncb
98 | *.opendb
99 | *.opensdf
100 | *.sdf
101 | *.cachefile
102 | *.VC.db
103 | *.VC.VC.opendb
104 |
105 | # Visual Studio profiler
106 | *.psess
107 | *.vsp
108 | *.vspx
109 | *.sap
110 |
111 | # Visual Studio Trace Files
112 | *.e2e
113 |
114 | # TFS 2012 Local Workspace
115 | $tf/
116 |
117 | # Guidance Automation Toolkit
118 | *.gpState
119 |
120 | # ReSharper is a .NET coding add-in
121 | _ReSharper*/
122 | *.[Rr]e[Ss]harper
123 | *.DotSettings.user
124 |
125 | # JustCode is a .NET coding add-in
126 | .JustCode
127 |
128 | # TeamCity is a build add-in
129 | _TeamCity*
130 |
131 | # DotCover is a Code Coverage Tool
132 | *.dotCover
133 |
134 | # AxoCover is a Code Coverage Tool
135 | .axoCover/*
136 | !.axoCover/settings.json
137 |
138 | # Visual Studio code coverage results
139 | *.coverage
140 | *.coveragexml
141 |
142 | # NCrunch
143 | _NCrunch_*
144 | .*crunch*.local.xml
145 | nCrunchTemp_*
146 |
147 | # MightyMoose
148 | *.mm.*
149 | AutoTest.Net/
150 |
151 | # Web workbench (sass)
152 | .sass-cache/
153 |
154 | # Installshield output folder
155 | [Ee]xpress/
156 |
157 | # DocProject is a documentation generator add-in
158 | DocProject/buildhelp/
159 | DocProject/Help/*.HxT
160 | DocProject/Help/*.HxC
161 | DocProject/Help/*.hhc
162 | DocProject/Help/*.hhk
163 | DocProject/Help/*.hhp
164 | DocProject/Help/Html2
165 | DocProject/Help/html
166 |
167 | # Click-Once directory
168 | publish/
169 |
170 | # Publish Web Output
171 | *.[Pp]ublish.xml
172 | *.azurePubxml
173 | # Note: Comment the next line if you want to checkin your web deploy settings,
174 | # but database connection strings (with potential passwords) will be unencrypted
175 | *.pubxml
176 | *.publishproj
177 |
178 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
179 | # checkin your Azure Web App publish settings, but sensitive information contained
180 | # in these scripts will be unencrypted
181 | PublishScripts/
182 |
183 | # NuGet Packages
184 | *.nupkg
185 | # The packages folder can be ignored because of Package Restore
186 | **/[Pp]ackages/*
187 | # except build/, which is used as an MSBuild target.
188 | !**/[Pp]ackages/build/
189 | # Uncomment if necessary however generally it will be regenerated when needed
190 | #!**/[Pp]ackages/repositories.config
191 | # NuGet v3's project.json files produces more ignorable files
192 | *.nuget.props
193 | *.nuget.targets
194 |
195 | # Microsoft Azure Build Output
196 | csx/
197 | *.build.csdef
198 |
199 | # Microsoft Azure Emulator
200 | ecf/
201 | rcf/
202 |
203 | # Windows Store app package directories and files
204 | AppPackages/
205 | BundleArtifacts/
206 | Package.StoreAssociation.xml
207 | _pkginfo.txt
208 | *.appx
209 |
210 | # Visual Studio cache files
211 | # files ending in .cache can be ignored
212 | *.[Cc]ache
213 | # but keep track of directories ending in .cache
214 | !?*.[Cc]ache/
215 |
216 | # Others
217 | ClientBin/
218 | ~$*
219 | *~
220 | *.dbmdl
221 | *.dbproj.schemaview
222 | *.jfm
223 | *.pfx
224 | *.publishsettings
225 | orleans.codegen.cs
226 |
227 | # Including strong name files can present a security risk
228 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
229 | #*.snk
230 |
231 | # Since there are multiple workflows, uncomment next line to ignore bower_components
232 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
233 | #bower_components/
234 |
235 | # RIA/Silverlight projects
236 | Generated_Code/
237 |
238 | # Backup & report files from converting an old project file
239 | # to a newer Visual Studio version. Backup files are not needed,
240 | # because we have git ;-)
241 | _UpgradeReport_Files/
242 | Backup*/
243 | UpgradeLog*.XML
244 | UpgradeLog*.htm
245 | ServiceFabricBackup/
246 | *.rptproj.bak
247 |
248 | # SQL Server files
249 | *.mdf
250 | *.ldf
251 | *.ndf
252 |
253 | # Business Intelligence projects
254 | *.rdl.data
255 | *.bim.layout
256 | *.bim_*.settings
257 | *.rptproj.rsuser
258 | *- Backup*.rdl
259 |
260 | # Microsoft Fakes
261 | FakesAssemblies/
262 |
263 | # GhostDoc plugin setting file
264 | *.GhostDoc.xml
265 |
266 | # Node.js Tools for Visual Studio
267 | .ntvs_analysis.dat
268 | node_modules/
269 |
270 | # Visual Studio 6 build log
271 | *.plg
272 |
273 | # Visual Studio 6 workspace options file
274 | *.opt
275 |
276 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
277 | *.vbw
278 |
279 | # Visual Studio LightSwitch build output
280 | **/*.HTMLClient/GeneratedArtifacts
281 | **/*.DesktopClient/GeneratedArtifacts
282 | **/*.DesktopClient/ModelManifest.xml
283 | **/*.Server/GeneratedArtifacts
284 | **/*.Server/ModelManifest.xml
285 | _Pvt_Extensions
286 |
287 | # Paket dependency manager
288 | .paket/paket.exe
289 | paket-files/
290 |
291 | # FAKE - F# Make
292 | .fake/
293 |
294 | # JetBrains Rider
295 | .idea/
296 | *.sln.iml
297 |
298 | # CodeRush personal settings
299 | .cr/personal
300 |
301 | # Python Tools for Visual Studio (PTVS)
302 | __pycache__/
303 | *.pyc
304 |
305 | # Cake - Uncomment if you are using it
306 | # tools/**
307 | # !tools/packages.config
308 |
309 | # Tabs Studio
310 | *.tss
311 |
312 | # Telerik's JustMock configuration file
313 | *.jmconfig
314 |
315 | # BizTalk build output
316 | *.btp.cs
317 | *.btm.cs
318 | *.odx.cs
319 | *.xsd.cs
320 |
321 | # OpenCover UI analysis results
322 | OpenCover/
323 |
324 | # Azure Stream Analytics local run output
325 | ASALocalRun/
326 |
327 | # MSBuild Binary and Structured Log
328 | *.binlog
329 |
330 | # NVidia Nsight GPU debugger configuration file
331 | *.nvuser
332 |
333 | # MFractors (Xamarin productivity tool) working folder
334 | .mfractor/
335 |
336 | # Local History for Visual Studio
337 | .localhistory/
338 |
339 | # BeatPulse healthcheck temp database
340 | healthchecksdb
--------------------------------------------------------------------------------
/Directory.build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | latest
4 | Dominic Jonas
5 | Dominic Jonas
6 | Sentinel.NLogViewer
7 | https://github.com/dojo90/NLogViewer
8 | git@github.com:dojo90/NLogViewer.git
9 | git
10 | sentinel nlog
11 | NlogViewer is a ui control library to visualize NLog logs
12 | LICENSE.md
13 | true
14 | true
15 | snupkg
16 | $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
17 |
18 |
19 |
20 |
21 | PreserveNewest
22 | true
23 | LICENSE.md
24 | false
25 |
26 |
27 |
--------------------------------------------------------------------------------
/GitVersion.yml:
--------------------------------------------------------------------------------
1 | mode: ContinuousDeployment
2 | branches:
3 | issue:
4 | tag: issue-{BranchName}
5 | increment: Inherit
6 | prevent-increment-of-merged-branch-version: false
7 | regex: ^(?=\d+-)
8 | source-branches:
9 | - develop
10 | - master
11 | - release
12 | - feature
13 | - support
14 | - hotfix
15 | - issue
16 | develop:
17 | increment: Patch
18 | ignore:
19 | sha: []
20 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Dominic Jonas
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/NLogViewer.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29609.76
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NLogViewer.TestApp", "src\NLogViewer.TestApp\NLogViewer.TestApp.csproj", "{FF15C180-042C-42D9-8687-24F1BEB5F4FB}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NLogViewer", "src\NLogViewer\NLogViewer.csproj", "{D1C5763C-DA9C-43E0-B7EA-DDC9AAA90AE7}"
9 | EndProject
10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2FF9C764-5BB9-4E66-B48B-6B7D746EA817}"
11 | ProjectSection(SolutionItems) = preProject
12 | Directory.build.props = Directory.build.props
13 | GitVersion.yml = GitVersion.yml
14 | EndProjectSection
15 | EndProject
16 | Global
17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
18 | Debug|Any CPU = Debug|Any CPU
19 | Release|Any CPU = Release|Any CPU
20 | EndGlobalSection
21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
22 | {FF15C180-042C-42D9-8687-24F1BEB5F4FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {FF15C180-042C-42D9-8687-24F1BEB5F4FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {FF15C180-042C-42D9-8687-24F1BEB5F4FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {FF15C180-042C-42D9-8687-24F1BEB5F4FB}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {D1C5763C-DA9C-43E0-B7EA-DDC9AAA90AE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {D1C5763C-DA9C-43E0-B7EA-DDC9AAA90AE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {D1C5763C-DA9C-43E0-B7EA-DDC9AAA90AE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {D1C5763C-DA9C-43E0-B7EA-DDC9AAA90AE7}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(ExtensibilityGlobals) = postSolution
35 | SolutionGuid = {F32EE165-3408-4FBD-9AA5-03E9FD4C9AC0}
36 | EndGlobalSection
37 | EndGlobal
38 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [1]: https://github.com/yarseyah/sentinel
2 | [2]: https://github.com/dojo90/NLogViewer/blob/master/src/NLogViewer/Targets/CacheTarget.cs
3 | [3]: https://github.com/yarseyah/sentinel#nlogs-nlogviewer-target-configuration
4 |
5 | [p1]: doc/images/control.png "NLogViewer"
6 | [p2]: doc/images/overview.gif "NLogViewer"
7 | [p3]: doc/images/colors.png "NLogViewer"
8 | [p4]: doc/images/openpopup.gif "NLogViewer"
9 | [p5]: doc/images/newtask.gif "NLogViewer"
10 |
11 | [nuget]: https://nuget.org/packages/Sentinel.NlogViewer/
12 |
13 | ## Nuget
14 |
15 | [](https://www.nuget.org/packages/Sentinel.NLogViewer)
16 | [](https://www.nuget.org/packages/Sentinel.NLogViewer)
17 |
18 | A NuGet-package is available [here][nuget].
19 |
20 | NlogViewer
21 | ==========
22 |
23 | NlogViewer is a ui control library to visualize NLog logs in your personal application. It is mainly based on [Sentinel][1] and its controls.
24 |
25 | supported Framework: `.NET6`
26 |
27 | ![NLogViewer][p2]
28 |
29 | ## Quick Start
30 |
31 | Add a namespace to your `Window`
32 |
33 | ```xaml
34 | xmlns:dj="clr-namespace:DJ;assembly=NLogViewer"
35 | ```
36 |
37 | use the control
38 | ```xaml
39 |
40 | ```
41 |
42 | `NlogViewer` is subscribing to [CacheTarget][2]. By default, the `NlogViewer` is automatically creating a [CacheTarget][2] with `loggingPattern "*"` and `LogLevel "Trace"`.
43 |
44 | If you want to customize the `loggingPattern` and `LogLevel`, add the following to your `Nlog.config`.
45 |
46 | ```xml
47 |
48 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
62 |
63 |
64 |
65 |
66 |
67 |
68 | ```
69 |
70 | ## Customize
71 |
72 | ### Colors
73 |
74 | Customize `foreground` or `background` of every `logLevel`
75 |
76 | ![NLogViewer][p3]
77 |
78 | ### Multi targeting
79 |
80 | Use more than one instance of `NLogViewer` to match different `rules`.
81 |
82 | Create 2 `targets` with their own `rules`.
83 |
84 | ```xml
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 | ```
95 |
96 | Set `TargetName` property to link them.
97 |
98 | ```xml
99 |
100 |
101 | ```
102 |
103 | ### Format output (ILogEventInfoResolver)
104 |
105 | To format the output of a `LogEventInfo`, implement a new instance of `ILogEventInfoResolver` and bind it to the `Resolver` you want to customize:
106 |
107 | ```csharp
108 | ///
109 | /// Reformat the DateTime
110 | ///
111 | public class FooTimeStampResolver : ILogEventInfoResolver
112 | {
113 | public string Resolve(LogEventInfo logEventInfo)
114 | {
115 | return logEventInfo.TimeStamp.ToUniversalTime().ToString();
116 | }
117 | }
118 | ```
119 |
120 | ```csharp
121 | NLogViewer1.TimeStampResolver = new FooTimeStampResolver();
122 | ```
123 |
124 | ## Samples
125 |
126 | ### open on a new window
127 |
128 | ![NLogViewer][p4]
129 |
130 | Create a new `Window` and add a default `NLogViewer`
131 |
132 | ```csharp
133 |
134 | ```
135 |
136 | Open the new `Window`
137 |
138 | ```csharp
139 | TestPopup popup = new TestPopup();
140 | popup.Show();
141 | ```
142 |
143 | ### seperate logger for a task
144 |
145 | ![NLogViewer][p5]
146 |
147 | Below is a sample how you could create a `NLogViewer` for a task
148 |
149 | ```csharp
150 | // create unique target name
151 | var taskNumber = _RandomTaskCounter++;
152 | string targetName = $"task{taskNumber}";
153 | // create a unique logger
154 | var loggerName = $"MyFoo.Logger.{taskNumber}";
155 | var logger = LogManager.GetLogger(loggerName);
156 |
157 | // create new CacheTarget
158 | CacheTarget target = new CacheTarget
159 | {
160 | Name = targetName
161 | };
162 |
163 | // get config // https://stackoverflow.com/a/3603571/6229375
164 | var config = LogManager.Configuration;
165 |
166 | // add target
167 | config.AddTarget(targetName, target);
168 |
169 | // create a logging rule for the new logger
170 | LoggingRule loggingRule = new LoggingRule(loggerName, LogLevel.Trace, target);
171 |
172 | // add the logger to the existing configuration
173 | config.LoggingRules.Add(loggingRule);
174 |
175 | // reassign config back to NLog
176 | LogManager.Configuration = config;
177 |
178 | // create a new NLogViewer Control with the unique logger target name
179 | NLogViewer nLogViewer = new NLogViewer
180 | {
181 | TargetName = targetName,
182 | };
183 |
184 | // add it to the tab control
185 | var tabItem = new TabItem { Header = $"Task {taskNumber}", Content = nLogViewer };
186 | TabControl1.Items.Add(tabItem);
187 | TabControl1.SelectedItem = tabItem;
188 |
189 | // create task which produces some output
190 | var task = new Task(async () =>
191 | {
192 | while (true)
193 | {
194 | logger.Info($"Hello from task nr. {taskNumber}. It's {DateTime.Now.ToLongTimeString()}");
195 | await Task.Delay(1000);
196 | }
197 | });
198 | ```
199 |
200 | ## Why CacheTarget?
201 |
202 | There is already a `NLogViewerTarget`, which is used for [Sentinel][1]. See [here][3]
203 |
204 | ```xml
205 |
209 | ```
210 |
211 | ## Contributors
212 |
213 | Feel free to make a PullRequest or open an Issue to extend this library!
--------------------------------------------------------------------------------
/createBranch.ps1:
--------------------------------------------------------------------------------
1 | param([string]$IssueName)
2 |
3 | $branchName = $IssueName
4 |
5 | ###########################################################
6 | # clean input string #
7 | ###########################################################
8 |
9 | # character replacement
10 | $rWhiteSpace = [regex]'[ ]{1,}'
11 | $rSlash = [regex]'[/]{1,}'
12 | $rBackSlash = [regex]'[\\]{1,}'
13 | $rSeperator = [regex]'[-]{2,}'
14 |
15 | $branchName = $rWhiteSpace.Replace($branchName, "-")
16 | $branchName = $rSlash.Replace($branchName, "-")
17 | $branchName = $rBackSlash.Replace($branchName, "-")
18 | $branchName = $rSeperator.Replace($branchName, "-")
19 | $branchName = $branchName.Trim('-')
20 |
21 | # limit bracnhname to 40 characters length
22 | $branchName = $branchName.Substring('0', '40')
23 |
24 | echo "New branch '$branchName' created"
25 |
26 | git checkout -b $branchName
27 | git add .
28 | git add -u
29 |
30 | #git commit -m "Description of my changes for issue $IssueName"
31 | #git push -u origin $branchName
--------------------------------------------------------------------------------
/doc/images/colors.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/djonasdev/NLogViewer/549c322ff5cffeacc3bdc74b113078a1579e5f09/doc/images/colors.png
--------------------------------------------------------------------------------
/doc/images/newtask.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/djonasdev/NLogViewer/549c322ff5cffeacc3bdc74b113078a1579e5f09/doc/images/newtask.gif
--------------------------------------------------------------------------------
/doc/images/openpopup.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/djonasdev/NLogViewer/549c322ff5cffeacc3bdc74b113078a1579e5f09/doc/images/openpopup.gif
--------------------------------------------------------------------------------
/doc/images/overview.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/djonasdev/NLogViewer/549c322ff5cffeacc3bdc74b113078a1579e5f09/doc/images/overview.gif
--------------------------------------------------------------------------------
/src/NLogViewer.TestApp/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/NLogViewer.TestApp/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/NLogViewer.TestApp/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace TestApplication
4 | {
5 | ///
6 | /// Interaktionslogik für "App.xaml"
7 | ///
8 | public partial class App : Application
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/NLogViewer.TestApp/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/src/NLogViewer.TestApp/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Reactive.Linq;
4 | using System.Reflection;
5 | using System.Threading;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using DJ;
10 | using DJ.Resolver;
11 | using DJ.Targets;
12 | using NLog;
13 | using NLog.Config;
14 | using NLog.Filters;
15 |
16 | namespace TestApplication
17 | {
18 | ///
19 | /// Interaktionslogik für MainWindow.xaml
20 | ///
21 | public partial class MainWindow : Window
22 | {
23 | public const string LOREM_IPSUM = @"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
24 |
25 | private readonly Logger _Logger = LogManager.GetCurrentClassLogger();
26 | private readonly Logger _Logger2 = LogManager.GetLogger("Lorem.Ipsum.Foo.Hello.World.Lorem.Ipsum");
27 |
28 | private int _CntMessage;
29 | private int _CntError;
30 |
31 |
32 | public MainWindow()
33 | {
34 | Title = $"NLogViewer TestApp v{Assembly.GetEntryAssembly().GetName().Version} - framework v{AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName}";
35 | InitializeComponent();
36 | DataContext = this;
37 |
38 | NLogViewer1.TimeStampResolver = new FooTimeStampResolver();
39 | Stopwatch stopwatch = Stopwatch.StartNew();
40 | Random random = new Random();
41 | Observable.Interval(TimeSpan.FromMilliseconds(200)).ObserveOn(SynchronizationContext.Current).Subscribe(l =>
42 | {
43 | //if((_CntMessage == 10 || _CntError == 20) && TabControl1.Items.Count > 0)
44 | // TabControl1.Items.RemoveAt(0);
45 | switch (random.Next(1, 6))
46 | {
47 | case 1:
48 | _CntMessage++;
49 | _Logger.Trace($"Hello everyone: {_CntMessage}");
50 | break;
51 | case 2:
52 | _CntMessage++;
53 | if (stopwatch.Elapsed.Seconds > 5)
54 | {
55 | _Logger2.Debug($"Hello everyone: {_CntMessage}");
56 | }
57 | else
58 | {
59 | _Logger.Debug($"Hello everyone: {_CntMessage}");
60 | }
61 |
62 | break;
63 | case 3:
64 | _CntMessage++;
65 | _Logger.Info($"Hello everyone: {_CntMessage}");
66 | break;
67 | case 4:
68 | _CntError++;
69 | _Logger.Warn($"Hello everyone: {_CntError}");
70 | break;
71 | case 5:
72 | _CntError++;
73 |
74 | try
75 | {
76 | int a = 0;
77 | int b = 1;
78 | var c = b / a;
79 | }
80 | catch (Exception ex)
81 | {
82 | _Logger.Error(ex, $"There was an error on divison :/ {_CntError}");
83 | }
84 |
85 | break;
86 | case 6:
87 | _CntError++;
88 | _Logger.Fatal($"{_CntError}\n{LOREM_IPSUM}");
89 | break;
90 | }
91 | });
92 | }
93 |
94 | private void Button_OpenPopup_Click(object sender, RoutedEventArgs e)
95 | {
96 | TestPopup popup = new TestPopup();
97 | popup.Show();
98 | }
99 |
100 | private void Button_AddTask_Click(object sender, RoutedEventArgs e)
101 | {
102 | AddNewTabWithLogger().Start();
103 | }
104 |
105 | private int _RandomTaskCounter;
106 | private Task AddNewTabWithLogger()
107 | {
108 | // create unique target name
109 | var taskNumber = _RandomTaskCounter++;
110 | string targetName = $"task{taskNumber}";
111 | // create a unique logger
112 | var loggerName = $"MyFoo.Logger.{taskNumber}";
113 | var logger = LogManager.GetLogger(loggerName);
114 |
115 | // create new CacheTarget
116 | CacheTarget target = new CacheTarget
117 | {
118 | Name = targetName
119 | };
120 |
121 | // get config // https://stackoverflow.com/a/3603571/6229375
122 | var config = LogManager.Configuration;
123 |
124 | // add target
125 | config.AddTarget(targetName, target);
126 |
127 | // create a logging rule for the new logger
128 | LoggingRule loggingRule = new LoggingRule(loggerName, LogLevel.Trace, target);
129 |
130 | // add the logger to the existing configuration
131 | config.LoggingRules.Add(loggingRule);
132 |
133 | // reassign config back to NLog
134 | LogManager.Configuration = config;
135 |
136 | // create a new NLogViewer Control with the unique logger target name
137 | NLogViewer nLogViewer = new NLogViewer
138 | {
139 | TargetName = targetName,
140 | };
141 |
142 | // add it to the tab control
143 | var tabItem = new TabItem { Header = $"Task {taskNumber}", Content = nLogViewer };
144 | TabControl1.Items.Add(tabItem);
145 | TabControl1.SelectedItem = tabItem;
146 |
147 | // create task which produces some output
148 | var task = new Task(async () =>
149 | {
150 | while (true)
151 | {
152 | logger.Info($"Hello from task nr. {taskNumber}. It's {DateTime.Now.ToLongTimeString()}");
153 | await Task.Delay(1000);
154 | }
155 | });
156 | return task;
157 | }
158 | }
159 |
160 | ///
161 | /// Reformat the DateTime
162 | ///
163 | public class FooTimeStampResolver : ILogEventInfoResolver
164 | {
165 | public string Resolve(LogEventInfo logEventInfo)
166 | {
167 | return logEventInfo.TimeStamp.ToUniversalTime().ToString();
168 | }
169 | }
170 | }
--------------------------------------------------------------------------------
/src/NLogViewer.TestApp/NLogViewer.TestApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net6-windows
6 | true
7 | TestApplication.App
8 | TestApplication
9 | TestApp
10 | false
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | Always
20 |
21 |
22 |
23 |
24 |
25 | all
26 | runtime; build; native; contentfiles; analyzers; buildtransitive
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/NLogViewer.TestApp/TestPopup.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/NLogViewer.TestApp/TestPopup.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Windows;
5 | using System.Windows.Controls;
6 | using System.Windows.Data;
7 | using System.Windows.Documents;
8 | using System.Windows.Input;
9 | using System.Windows.Media;
10 | using System.Windows.Media.Imaging;
11 | using System.Windows.Shapes;
12 |
13 | namespace TestApplication
14 | {
15 | ///
16 | /// Interaktionslogik für TestPopup.xaml
17 | ///
18 | public partial class TestPopup : Window
19 | {
20 | public TestPopup()
21 | {
22 | InitializeComponent();
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/NLogViewer.TestApp/nlog.config:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/NLogViewer.TestApp/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/NLogViewer/ActionCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Input;
3 |
4 | namespace DJ
5 | {
6 | public sealed class ActionCommand : ICommand
7 | {
8 | private readonly Action _Action;
9 | private readonly Action