├── .config
└── dotnet-tools.json
├── .editorconfig
├── .gitattributes
├── .github
├── FUNDING.yml
├── dependabot.yml
└── workflows
│ └── dependabot-cake.yml
├── .gitignore
├── CHANGES.md
├── CODEOWNERS
├── LICENSE
├── README.md
├── SECURITY.md
├── assets
├── prism-nuget.png
└── prism.snk
├── global.json
├── nuget.config
├── prism-logging-serilog.sln
├── prism-logging-serilog.sln.DotSettings
├── sample
├── net45
│ └── PrismSerilogWpfDemoNet45
│ │ ├── App.config
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ ├── PrismSerilogWpfDemoNet45.csproj
│ │ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ │ ├── ViewModels
│ │ └── MainWindowViewModel.cs
│ │ ├── Views
│ │ ├── MainWindow.xaml
│ │ └── MainWindow.xaml.cs
│ │ └── packages.config
├── netcoreapp3.0
│ └── PrismSerilogWpfDemoNetCoreApp30
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ ├── PrismSerilogWpfDemoNetCoreApp30.csproj
│ │ ├── ViewModels
│ │ └── MainWindowViewModel.cs
│ │ └── Views
│ │ ├── MainWindow.xaml
│ │ └── MainWindow.xaml.cs
└── netstandard2.0
│ └── PrismSerilogXamarinDemoNetStandard20
│ ├── PrismSerilogXamarinDemoNetStandard20.Android
│ ├── AndroidInitializer.cs
│ ├── Assets
│ │ └── AboutAssets.txt
│ ├── MainActivity.cs
│ ├── PrismSerilogXamarinDemoNetStandard20.Android.csproj
│ ├── Properties
│ │ ├── AndroidManifest.xml
│ │ └── AssemblyInfo.cs
│ └── Resources
│ │ ├── AboutResources.txt
│ │ ├── layout
│ │ ├── Tabbar.xml
│ │ └── Toolbar.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── icon.xml
│ │ └── icon_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── icon.png
│ │ └── launcher_foreground.png
│ │ ├── mipmap-mdpi
│ │ ├── icon.png
│ │ └── launcher_foreground.png
│ │ ├── mipmap-xhdpi
│ │ ├── icon.png
│ │ └── launcher_foreground.png
│ │ ├── mipmap-xxhdpi
│ │ ├── icon.png
│ │ └── launcher_foreground.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── icon.png
│ │ └── launcher_foreground.png
│ │ └── values
│ │ ├── colors.xml
│ │ └── styles.xml
│ ├── PrismSerilogXamarinDemoNetStandard20.iOS
│ ├── AppDelegate.cs
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── Icon1024.png
│ │ │ ├── Icon120.png
│ │ │ ├── Icon152.png
│ │ │ ├── Icon167.png
│ │ │ ├── Icon180.png
│ │ │ ├── Icon20.png
│ │ │ ├── Icon29.png
│ │ │ ├── Icon40.png
│ │ │ ├── Icon58.png
│ │ │ ├── Icon60.png
│ │ │ ├── Icon76.png
│ │ │ ├── Icon80.png
│ │ │ └── Icon87.png
│ ├── Entitlements.plist
│ ├── Info.plist
│ ├── Main.cs
│ ├── PrismSerilogXamarinDemoNetStandard20.iOS.csproj
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Resources
│ │ ├── Default-568h@2x.png
│ │ ├── Default-Portrait.png
│ │ ├── Default-Portrait@2x.png
│ │ ├── Default.png
│ │ ├── Default@2x.png
│ │ └── LaunchScreen.storyboard
│ └── iOSInitializer.cs
│ └── PrismSerilogXamarinDemoNetStandard20
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── AssemblyInfo.cs
│ ├── PrismSerilogXamarinDemoNetStandard20.csproj
│ ├── ViewModels
│ └── MainPageViewModel.cs
│ └── Views
│ ├── MainPage.xaml
│ └── MainPage.xaml.cs
├── src
└── Prism.Logging.Serilog
│ ├── Ioc
│ └── IContainerRegistryExtensions.cs
│ ├── Logging
│ └── Serilog
│ │ └── SerilogLoggerFacade.cs
│ └── Prism.Logging.Serilog.csproj
└── test
└── Prism.Logging.Serilog.Tests
├── Prism.Logging.Serilog.Tests.csproj
├── SerilogLoggerFacadeTests.cs
└── Support
├── DelegatingSink.cs
├── Extensions.cs
└── MockLoggerFacade.cs
/.config/dotnet-tools.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 1,
3 | "isRoot": true,
4 | "tools": {
5 | "cake.tool": {
6 | "version": "1.3.0",
7 | "commands": [
8 | "dotnet-cake"
9 | ]
10 | },
11 | "minver-cli": {
12 | "version": "4.3.0",
13 | "commands": [
14 | "minver"
15 | ]
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig is awesome: http://EditorConfig.org
2 |
3 | # top-most EditorConfig file
4 | root = true
5 |
6 | [*]
7 | end_of_line = unset
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 | indent_style = space
11 | indent_size = 4
12 |
13 | [*.{proj,props,sln,targets,sql}]
14 | indent_style = tab
15 |
16 | [*.{xml,dna,config,nuspec,csproj,vcxproj,vcproj,targets,ps1,resx}]
17 | indent_size = 2
18 |
19 | [*.{cpp,h,def}]
20 | indent_style = tab
21 |
22 | [*.{dotsettings}]
23 | end_of_line = lf
24 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Set the default behavior, in case people don't have core.autocrlf set
2 | * text=auto
3 |
4 | # Explicitly declare files that should always be converted to LF regardless of platform
5 | *.dotsettings text eol=lf
6 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: augustoproiete
2 | tidelift: "nuget/Prism.Logging.Serilog"
3 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: "nuget"
4 | directory: "/"
5 | schedule:
6 | interval: "daily"
7 | target-branch: "master"
8 | ignore:
9 | - dependency-name: "Serilog"
10 | - package-ecosystem: "github-actions"
11 | directory: "/"
12 | schedule:
13 | interval: "daily"
14 | target-branch: "master"
15 |
--------------------------------------------------------------------------------
/.github/workflows/dependabot-cake.yml:
--------------------------------------------------------------------------------
1 | on:
2 | schedule:
3 | # every Sunday at 6am
4 | - cron: '0 6 * * SUN'
5 |
6 | workflow_dispatch:
7 |
8 | jobs:
9 | dependabot-cake:
10 | runs-on: ubuntu-20.04
11 | steps:
12 | - name: check/update cake dependencies
13 | uses: augustoproiete-actions/nils-org--dependabot-cake-action@v1.1.0
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #Ignore thumbnails created by Windows
2 | Thumbs.db
3 |
4 | #Ignore metadata created by OSX
5 | .DS_Store
6 | ._*
7 |
8 | #Ignore files created by Visual Studio
9 | .vs/
10 | *.user
11 | *.suo
12 | *.tmp_proj
13 | *.cache
14 | *.vsdoc
15 | [Oo]bj/
16 | [Bb]in/
17 | [Dd]ebug/
18 | [Rr]elease/
19 | [Aa]rtifacts/
20 | [Ll]og/
21 | [Tt]emp/
22 |
23 | # Ignore NuGet Packages
24 | *.nupkg
25 | **/packages/*
26 |
27 | #Ignore files created by ReSharper
28 | _ReSharper*/
29 |
--------------------------------------------------------------------------------
/CHANGES.md:
--------------------------------------------------------------------------------
1 | See: https://github.com/augustoproiete/prism-logging-serilog/releases
2 |
--------------------------------------------------------------------------------
/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @augustoproiete
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright 2019-2023 C. Augusto Proiete & Contributors
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | | README.md |
2 | |:---|
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Prism.Logging.Serilog
11 |
12 |
13 | Integrate [Serilog](https://serilog.net) with [Prism](https://prismlibrary.github.io) in your WPF, UWP, or Xamarin Forms apps.
14 |
15 | [](https://www.nuget.org/packages/Prism.Logging.Serilog) [](http://stackoverflow.com/questions/tagged/serilog) [](http://stackoverflow.com/questions/tagged/prism)
16 |
17 | This project provides a custom implementation of Prism's `ILoggerFacade`, that forwards messages to a Serilog logger, allowing developers to capture the logging events written in their _ViewModels_ and _Services_, in Serilog.
18 |
19 |
20 |
21 | ## Give a Star! :star:
22 |
23 | If you like or are using this project please give it a star. Thanks!
24 |
25 | ## Getting started :rocket:
26 |
27 | To use the `Prism.Logging.Serilog`, first install the [NuGet package](https://nuget.org/packages/prism.logging.serilog):
28 |
29 | ```powershell
30 | Install-Package Prism.Logging.Serilog
31 | ```
32 |
33 | Then register Serilog with Prism's `IContainerRegistry` using `RegisterSerilog()`:
34 |
35 | ```csharp
36 | protected override void RegisterTypes(IContainerRegistry containerRegistry)
37 | {
38 | // ...
39 |
40 | containerRegistry.RegisterSerilog();
41 | }
42 | ```
43 |
44 | Log events from Prism will be written to Serilog's `Log.Logger` by default. Alternatively, you can provide a specific instance of a `Serilog.ILogger`:
45 |
46 | ```csharp
47 | private Serilog.ILogger _logger = Log.Logger;
48 |
49 | protected override void RegisterTypes(IContainerRegistry containerRegistry)
50 | {
51 | // ...
52 |
53 | containerRegistry.RegisterSerilog(_logger);
54 | }
55 | ```
56 |
57 | ## Mapping of Prism Log messages to Serilog
58 |
59 | `Prism.Logging.Serilog` does The Right Thing™ :), as you'd expect:
60 |
61 | | Prism Category | Serilog LogEventLevel |
62 | | -------------------- | --------------------------- |
63 | | `Category.Debug` | `LogEventLevel.Debug` |
64 | | `Category.Info` | `LogEventLevel.Information` |
65 | | `Category.Warn` | `LogEventLevel.Warning` |
66 | | `Category.Exception` | `LogEventLevel.Error` |
67 |
68 | * The `Priority` set in log messages written via Prism gets forwarded to Serilog as a [context property](https://github.com/serilog/serilog/wiki/Writing-Log-Events#correlation) called `Priority`, with the value of the priority as a string. e.g. `"High"`.
69 |
70 | * Log messages forwarded to Serilog have the [`SourceContext`](https://github.com/serilog/serilog/wiki/Writing-Log-Events#source-contexts) property set to `Prism.Logging.Serilog.SerilogLoggerFacade`, allowing developers to use use [filters](https://github.com/serilog/serilog/wiki/Configuration-Basics#filters), [sub-loggers](https://github.com/serilog/serilog/wiki/Configuration-Basics#sub-loggers), and [minimum level overrides](https://github.com/serilog/serilog/wiki/AppSettings#adding-minimum-level-overrides).
71 |
72 | ## Example
73 |
74 | In the source code you can find a [demo project](sample) of a WPF application using Prism and Serilog. The initial setup looks something like this:
75 |
76 | ```csharp
77 | public partial class App
78 | {
79 | protected override void OnStartup(StartupEventArgs e)
80 | {
81 | // Configure Serilog and the sinks at the startup of the app
82 | Log.Logger = new LoggerConfiguration()
83 | .MinimumLevel.Debug()
84 | .WriteTo.File(path: "MyApp.log")
85 | .CreateLogger();
86 |
87 | base.OnStartup(e);
88 | }
89 |
90 | protected override void OnExit(ExitEventArgs e)
91 | {
92 | // Flush all Serilog sinks before the app closes
93 | Log.CloseAndFlush();
94 |
95 | base.OnExit(e);
96 | }
97 |
98 | protected override void RegisterTypes(IContainerRegistry containerRegistry)
99 | {
100 | // Register your ViewModels, Services, etc...
101 | // ...
102 |
103 | // Register Serilog with Prism
104 | containerRegistry.RegisterSerilog();
105 | }
106 |
107 | protected override Window CreateShell()
108 | {
109 | return Container.Resolve();
110 | }
111 | }
112 | ```
113 |
114 | ## Release History
115 |
116 | Click on the [Releases](https://github.com/augustoproiete/prism-logging-serilog/releases) tab on GitHub.
117 |
118 | ---
119 |
120 | _Copyright © 2019-2023 C. Augusto Proiete & Contributors - Provided under the [Apache License, Version 2.0](LICENSE)._
121 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | ## Security contact information
2 |
3 | To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
4 |
--------------------------------------------------------------------------------
/assets/prism-nuget.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/assets/prism-nuget.png
--------------------------------------------------------------------------------
/assets/prism.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/assets/prism.snk
--------------------------------------------------------------------------------
/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "sdk": {
3 | "allowPrerelease": false,
4 | "version": "3.1.100",
5 | "rollForward": "latestFeature"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/prism-logging-serilog.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29201.188
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample", "sample", "{2E38532A-A66C-498A-8FBF-4D6FE6F31ECC}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrismSerilogWpfDemoNet45", "sample\net45\PrismSerilogWpfDemoNet45\PrismSerilogWpfDemoNet45.csproj", "{CB57A3B5-DDC6-48C3-B031-7216A83A2970}"
9 | EndProject
10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A918D06F-30C4-48CA-8E75-90131BA4B8D8}"
11 | EndProject
12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Prism.Logging.Serilog", "src\Prism.Logging.Serilog\Prism.Logging.Serilog.csproj", "{88146B27-E104-4939-99FD-70557287F877}"
13 | EndProject
14 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{2CB13D58-3C7B-4AAA-8ADD-F0C3CD52EEE4}"
15 | EndProject
16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Prism.Logging.Serilog.Tests", "test\Prism.Logging.Serilog.Tests\Prism.Logging.Serilog.Tests.csproj", "{49AF6C05-BB7C-437D-B163-813939457192}"
17 | EndProject
18 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "net45", "net45", "{C8C51579-94E5-400E-914C-3616DBAEBF49}"
19 | EndProject
20 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "netcoreapp3.0", "netcoreapp3.0", "{845167A8-94BF-43C0-B1AD-878B47FDA827}"
21 | EndProject
22 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrismSerilogWpfDemoNetCoreApp30", "sample\netcoreapp3.0\PrismSerilogWpfDemoNetCoreApp30\PrismSerilogWpfDemoNetCoreApp30.csproj", "{D16CA8E1-8130-4E9D-8AD2-856F6768DC0C}"
23 | EndProject
24 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "netstandard2.0", "netstandard2.0", "{327D087D-2A5E-487B-BCFE-C2EE8EAC3FC7}"
25 | EndProject
26 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrismSerilogXamarinDemoNetStandard20", "sample\netstandard2.0\PrismSerilogXamarinDemoNetStandard20\PrismSerilogXamarinDemoNetStandard20\PrismSerilogXamarinDemoNetStandard20.csproj", "{BF0EB14A-E346-486B-B27E-3F9632A5F16E}"
27 | EndProject
28 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrismSerilogXamarinDemoNetStandard20.Android", "sample\netstandard2.0\PrismSerilogXamarinDemoNetStandard20\PrismSerilogXamarinDemoNetStandard20.Android\PrismSerilogXamarinDemoNetStandard20.Android.csproj", "{4D03E699-7664-42A4-8A4C-03E69830B120}"
29 | EndProject
30 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrismSerilogXamarinDemoNetStandard20.iOS", "sample\netstandard2.0\PrismSerilogXamarinDemoNetStandard20\PrismSerilogXamarinDemoNetStandard20.iOS\PrismSerilogXamarinDemoNetStandard20.iOS.csproj", "{C2327E37-42DC-4154-95DA-47CBC123890F}"
31 | EndProject
32 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{E6D8E5BF-215F-4E52-BD7F-1AD11A7553C1}"
33 | ProjectSection(SolutionItems) = preProject
34 | .editorconfig = .editorconfig
35 | .gitattributes = .gitattributes
36 | .gitignore = .gitignore
37 | CHANGES.md = CHANGES.md
38 | CODEOWNERS = CODEOWNERS
39 | global.json = global.json
40 | LICENSE = LICENSE
41 | README.md = README.md
42 | SECURITY.md = SECURITY.md
43 | EndProjectSection
44 | EndProject
45 | Global
46 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
47 | Debug|Any CPU = Debug|Any CPU
48 | Release|Any CPU = Release|Any CPU
49 | EndGlobalSection
50 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
51 | {CB57A3B5-DDC6-48C3-B031-7216A83A2970}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
52 | {CB57A3B5-DDC6-48C3-B031-7216A83A2970}.Debug|Any CPU.Build.0 = Debug|Any CPU
53 | {CB57A3B5-DDC6-48C3-B031-7216A83A2970}.Release|Any CPU.ActiveCfg = Release|Any CPU
54 | {CB57A3B5-DDC6-48C3-B031-7216A83A2970}.Release|Any CPU.Build.0 = Release|Any CPU
55 | {88146B27-E104-4939-99FD-70557287F877}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
56 | {88146B27-E104-4939-99FD-70557287F877}.Debug|Any CPU.Build.0 = Debug|Any CPU
57 | {88146B27-E104-4939-99FD-70557287F877}.Release|Any CPU.ActiveCfg = Release|Any CPU
58 | {88146B27-E104-4939-99FD-70557287F877}.Release|Any CPU.Build.0 = Release|Any CPU
59 | {49AF6C05-BB7C-437D-B163-813939457192}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
60 | {49AF6C05-BB7C-437D-B163-813939457192}.Debug|Any CPU.Build.0 = Debug|Any CPU
61 | {49AF6C05-BB7C-437D-B163-813939457192}.Release|Any CPU.ActiveCfg = Release|Any CPU
62 | {49AF6C05-BB7C-437D-B163-813939457192}.Release|Any CPU.Build.0 = Release|Any CPU
63 | {D16CA8E1-8130-4E9D-8AD2-856F6768DC0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
64 | {D16CA8E1-8130-4E9D-8AD2-856F6768DC0C}.Debug|Any CPU.Build.0 = Debug|Any CPU
65 | {D16CA8E1-8130-4E9D-8AD2-856F6768DC0C}.Release|Any CPU.ActiveCfg = Release|Any CPU
66 | {D16CA8E1-8130-4E9D-8AD2-856F6768DC0C}.Release|Any CPU.Build.0 = Release|Any CPU
67 | {BF0EB14A-E346-486B-B27E-3F9632A5F16E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
68 | {BF0EB14A-E346-486B-B27E-3F9632A5F16E}.Debug|Any CPU.Build.0 = Debug|Any CPU
69 | {BF0EB14A-E346-486B-B27E-3F9632A5F16E}.Release|Any CPU.ActiveCfg = Release|Any CPU
70 | {BF0EB14A-E346-486B-B27E-3F9632A5F16E}.Release|Any CPU.Build.0 = Release|Any CPU
71 | {4D03E699-7664-42A4-8A4C-03E69830B120}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
72 | {4D03E699-7664-42A4-8A4C-03E69830B120}.Debug|Any CPU.Build.0 = Debug|Any CPU
73 | {4D03E699-7664-42A4-8A4C-03E69830B120}.Release|Any CPU.ActiveCfg = Release|Any CPU
74 | {4D03E699-7664-42A4-8A4C-03E69830B120}.Release|Any CPU.Build.0 = Release|Any CPU
75 | {C2327E37-42DC-4154-95DA-47CBC123890F}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
76 | {C2327E37-42DC-4154-95DA-47CBC123890F}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
77 | {C2327E37-42DC-4154-95DA-47CBC123890F}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
78 | {C2327E37-42DC-4154-95DA-47CBC123890F}.Release|Any CPU.Build.0 = Release|iPhoneSimulator
79 | EndGlobalSection
80 | GlobalSection(SolutionProperties) = preSolution
81 | HideSolutionNode = FALSE
82 | EndGlobalSection
83 | GlobalSection(NestedProjects) = preSolution
84 | {CB57A3B5-DDC6-48C3-B031-7216A83A2970} = {C8C51579-94E5-400E-914C-3616DBAEBF49}
85 | {88146B27-E104-4939-99FD-70557287F877} = {A918D06F-30C4-48CA-8E75-90131BA4B8D8}
86 | {49AF6C05-BB7C-437D-B163-813939457192} = {2CB13D58-3C7B-4AAA-8ADD-F0C3CD52EEE4}
87 | {C8C51579-94E5-400E-914C-3616DBAEBF49} = {2E38532A-A66C-498A-8FBF-4D6FE6F31ECC}
88 | {845167A8-94BF-43C0-B1AD-878B47FDA827} = {2E38532A-A66C-498A-8FBF-4D6FE6F31ECC}
89 | {D16CA8E1-8130-4E9D-8AD2-856F6768DC0C} = {845167A8-94BF-43C0-B1AD-878B47FDA827}
90 | {327D087D-2A5E-487B-BCFE-C2EE8EAC3FC7} = {2E38532A-A66C-498A-8FBF-4D6FE6F31ECC}
91 | {BF0EB14A-E346-486B-B27E-3F9632A5F16E} = {327D087D-2A5E-487B-BCFE-C2EE8EAC3FC7}
92 | {4D03E699-7664-42A4-8A4C-03E69830B120} = {327D087D-2A5E-487B-BCFE-C2EE8EAC3FC7}
93 | {C2327E37-42DC-4154-95DA-47CBC123890F} = {327D087D-2A5E-487B-BCFE-C2EE8EAC3FC7}
94 | EndGlobalSection
95 | GlobalSection(ExtensibilityGlobals) = postSolution
96 | SolutionGuid = {7215B999-A555-49A3-ACCA-ABF01EE7C25B}
97 | EndGlobalSection
98 | EndGlobal
99 |
--------------------------------------------------------------------------------
/prism-logging-serilog.sln.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | DO_NOT_SHOW
3 | DO_NOT_SHOW
4 | DO_NOT_SHOW
5 | DO_NOT_SHOW
6 | DO_NOT_SHOW
7 | DO_NOT_SHOW
8 | DO_NOT_SHOW
9 | DO_NOT_SHOW
10 | DO_NOT_SHOW
11 | DO_NOT_SHOW
--------------------------------------------------------------------------------
/sample/net45/PrismSerilogWpfDemoNet45/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/sample/net45/PrismSerilogWpfDemoNet45/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/sample/net45/PrismSerilogWpfDemoNet45/App.xaml.cs:
--------------------------------------------------------------------------------
1 | #region Copyright 2019-2023 C. Augusto Proiete & Contributors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | #endregion
16 |
17 | using System.Text;
18 | using System.Windows;
19 | using Prism.Ioc;
20 | using Serilog;
21 | using PrismSerilogWpfDemoNet45.Views;
22 |
23 | namespace PrismSerilogWpfDemoNet45
24 | {
25 | public partial class App
26 | {
27 | protected override void OnStartup(StartupEventArgs e)
28 | {
29 | Log.Logger = new LoggerConfiguration()
30 | .MinimumLevel.Debug()
31 | .WriteTo.File(path: "DemoLog.txt", encoding: Encoding.UTF8)
32 | .CreateLogger();
33 |
34 | base.OnStartup(e);
35 | }
36 |
37 | protected override void OnExit(ExitEventArgs e)
38 | {
39 | Log.CloseAndFlush();
40 |
41 | base.OnExit(e);
42 | }
43 |
44 | protected override void RegisterTypes(IContainerRegistry containerRegistry)
45 | {
46 | containerRegistry.RegisterSerilog();
47 | }
48 |
49 | protected override Window CreateShell()
50 | {
51 | return Container.Resolve();
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/sample/net45/PrismSerilogWpfDemoNet45/PrismSerilogWpfDemoNet45.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {CB57A3B5-DDC6-48C3-B031-7216A83A2970}
8 | WinExe
9 | PrismSerilogWpfDemoNet45
10 | PrismSerilogWpfDemoNet45
11 | v4.5
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 | ..\..\..\packages\CommonServiceLocator.2.0.4\lib\net45\CommonServiceLocator.dll
39 |
40 |
41 | ..\..\..\packages\Prism.Core.7.2.0.1422\lib\net45\Prism.dll
42 |
43 |
44 | ..\..\..\packages\Prism.Unity.7.2.0.1422\lib\net45\Prism.Unity.Wpf.dll
45 |
46 |
47 | ..\..\..\packages\Prism.Wpf.7.2.0.1422\lib\net45\Prism.Wpf.dll
48 |
49 |
50 | ..\..\..\packages\Serilog.2.8.0\lib\net45\Serilog.dll
51 |
52 |
53 | ..\..\..\packages\Serilog.Sinks.File.4.0.0\lib\net45\Serilog.Sinks.File.dll
54 |
55 |
56 |
57 |
58 |
59 |
60 | ..\..\..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll
61 |
62 |
63 | ..\..\..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll
64 |
65 |
66 | ..\..\..\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll
67 |
68 |
69 | ..\..\..\packages\Prism.Wpf.7.2.0.1422\lib\net45\System.Windows.Interactivity.dll
70 |
71 |
72 | 4.0
73 |
74 |
75 | ..\..\..\packages\Unity.Abstractions.5.11.1\lib\net45\Unity.Abstractions.dll
76 |
77 |
78 | ..\..\..\packages\Unity.Container.5.11.1\lib\net45\Unity.Container.dll
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 | MSBuild:Compile
87 | Designer
88 |
89 |
90 | MSBuild:Compile
91 | Designer
92 |
93 |
94 | App.xaml
95 | Code
96 |
97 |
98 |
99 | MainWindow.xaml
100 | Code
101 |
102 |
103 |
104 |
105 | Code
106 |
107 |
108 | True
109 | True
110 | Resources.resx
111 |
112 |
113 | True
114 | Settings.settings
115 | True
116 |
117 |
118 | ResXFileCodeGenerator
119 | Resources.Designer.cs
120 |
121 |
122 |
123 | SettingsSingleFileGenerator
124 | Settings.Designer.cs
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 | {88146b27-e104-4939-99fd-70557287f877}
133 | Prism.Logging.Serilog
134 |
135 |
136 |
137 |
--------------------------------------------------------------------------------
/sample/net45/PrismSerilogWpfDemoNet45/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 | using System.Windows;
4 |
5 | [assembly: AssemblyTitle("PrismSerilogWpfDemoNet45")]
6 | [assembly: AssemblyDescription("")]
7 | [assembly: AssemblyConfiguration("")]
8 | [assembly: AssemblyCompany("augustoproiete.net")]
9 | [assembly: AssemblyProduct("PrismSerilogWpfDemoNet45")]
10 | [assembly: AssemblyCopyright("Copyright 2019-2023 C. Augusto Proiete & Contributors")]
11 | [assembly: AssemblyTrademark("")]
12 | [assembly: AssemblyCulture("")]
13 |
14 | [assembly: ComVisible(false)]
15 |
16 | [assembly: ThemeInfo(
17 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
18 | //(used if a resource is not found in the page,
19 | // or application resource dictionaries)
20 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
21 | //(used if a resource is not found in the page,
22 | // app, or any theme specific resource dictionaries)
23 | )]
24 |
25 | [assembly: AssemblyVersion("1.0.0.0")]
26 | [assembly: AssemblyFileVersion("1.0.0.0")]
27 | [assembly: AssemblyInformationalVersion("1.0.0")]
28 |
--------------------------------------------------------------------------------
/sample/net45/PrismSerilogWpfDemoNet45/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace PrismSerilogWpfDemoNet45.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PrismSerilogWpfDemo.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/sample/net45/PrismSerilogWpfDemoNet45/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/sample/net45/PrismSerilogWpfDemoNet45/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace PrismSerilogWpfDemoNet45.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/sample/net45/PrismSerilogWpfDemoNet45/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/sample/net45/PrismSerilogWpfDemoNet45/ViewModels/MainWindowViewModel.cs:
--------------------------------------------------------------------------------
1 | #region Copyright 2019-2023 C. Augusto Proiete & Contributors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | #endregion
16 |
17 | using System;
18 | using System.IO;
19 | using System.Text;
20 | using Prism.Commands;
21 | using Prism.Logging;
22 | using Prism.Mvvm;
23 |
24 | namespace PrismSerilogWpfDemoNet45.ViewModels
25 | {
26 | public class MainWindowViewModel : BindableBase
27 | {
28 | private readonly ILoggerFacade _logger;
29 | private string _title = "Prism Serilog WPF Demo (.NET 4.5)";
30 |
31 | public MainWindowViewModel(ILoggerFacade logger)
32 | {
33 | _logger = logger ?? throw new ArgumentNullException(nameof(logger));
34 |
35 | LogDebugCommand = new DelegateCommand(LogDebug);
36 | LogInformationCommand = new DelegateCommand(LogInformation);
37 | LogWarningCommand = new DelegateCommand(LogWarning);
38 | LogExceptionCommand = new DelegateCommand(LogException);
39 | }
40 |
41 | public string Title
42 | {
43 | get => _title;
44 | set => SetProperty(ref _title, value);
45 | }
46 |
47 | public string Text
48 | {
49 | get
50 | {
51 | const string logFileName = "DemoLog.txt";
52 |
53 | if (!File.Exists(logFileName))
54 | {
55 | return null;
56 | }
57 |
58 | // FileShare.ReadWrite required for Serilog to continue writing - File.ReadAllText doesn't allow that
59 | using (var stream = new FileStream(logFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
60 | {
61 | using (var reader = new StreamReader(stream, Encoding.UTF8, detectEncodingFromByteOrderMarks: true))
62 | {
63 | return reader.ReadToEnd();
64 | }
65 | }
66 | }
67 | }
68 |
69 | public DelegateCommand LogDebugCommand { get; }
70 | public DelegateCommand LogInformationCommand { get; }
71 | public DelegateCommand LogWarningCommand { get; }
72 | public DelegateCommand LogExceptionCommand { get; }
73 |
74 | private void LogDebug()
75 | {
76 | _logger.Log("This is a Debug message!", Category.Debug, Priority.High);
77 |
78 | RaisePropertyChanged(nameof(Text));
79 | }
80 |
81 | private void LogInformation()
82 | {
83 | _logger.Log("This is an Information message!", Category.Info, Priority.High);
84 |
85 | RaisePropertyChanged(nameof(Text));
86 | }
87 |
88 | private void LogWarning()
89 | {
90 | _logger.Log("This is an Warning message!", Category.Warn, Priority.High);
91 |
92 | RaisePropertyChanged(nameof(Text));
93 | }
94 |
95 | private void LogException()
96 | {
97 | _logger.Log("This is an Exception message!", Category.Exception, Priority.High);
98 |
99 | RaisePropertyChanged(nameof(Text));
100 | }
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/sample/net45/PrismSerilogWpfDemoNet45/Views/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 | Log messages are being written to `DemoLog.txt`
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/sample/net45/PrismSerilogWpfDemoNet45/Views/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | #region Copyright 2019-2023 C. Augusto Proiete & Contributors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | #endregion
16 |
17 | using System.Windows;
18 |
19 | namespace PrismSerilogWpfDemoNet45.Views
20 | {
21 | public partial class MainWindow : Window
22 | {
23 | public MainWindow()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/sample/net45/PrismSerilogWpfDemoNet45/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/sample/netcoreapp3.0/PrismSerilogWpfDemoNetCoreApp30/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/sample/netcoreapp3.0/PrismSerilogWpfDemoNetCoreApp30/App.xaml.cs:
--------------------------------------------------------------------------------
1 | #region Copyright 2019-2023 C. Augusto Proiete & Contributors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | #endregion
16 |
17 | using System.Text;
18 | using System.Windows;
19 | using Prism.Ioc;
20 | using Serilog;
21 | using PrismSerilogWpfDemoNetCoreApp30.Views;
22 |
23 | namespace PrismSerilogWpfDemoNetCoreApp30
24 | {
25 | public partial class App
26 | {
27 | protected override void OnStartup(StartupEventArgs e)
28 | {
29 | Log.Logger = new LoggerConfiguration()
30 | .MinimumLevel.Debug()
31 | .WriteTo.File(path: "DemoLog.txt", encoding: Encoding.UTF8)
32 | .CreateLogger();
33 |
34 | base.OnStartup(e);
35 | }
36 |
37 | protected override void OnExit(ExitEventArgs e)
38 | {
39 | Log.CloseAndFlush();
40 |
41 | base.OnExit(e);
42 | }
43 |
44 | protected override void RegisterTypes(IContainerRegistry containerRegistry)
45 | {
46 | containerRegistry.RegisterSerilog();
47 | }
48 |
49 | protected override Window CreateShell()
50 | {
51 | return Container.Resolve();
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/sample/netcoreapp3.0/PrismSerilogWpfDemoNetCoreApp30/PrismSerilogWpfDemoNetCoreApp30.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | netcoreapp3.0
6 | true
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/sample/netcoreapp3.0/PrismSerilogWpfDemoNetCoreApp30/ViewModels/MainWindowViewModel.cs:
--------------------------------------------------------------------------------
1 | #region Copyright 2019-2023 C. Augusto Proiete & Contributors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | #endregion
16 |
17 | using System;
18 | using System.IO;
19 | using System.Text;
20 | using Prism.Commands;
21 | using Prism.Logging;
22 | using Prism.Mvvm;
23 |
24 | namespace PrismSerilogWpfDemoNetCoreApp30.ViewModels
25 | {
26 | public class MainWindowViewModel : BindableBase
27 | {
28 | private readonly ILoggerFacade _logger;
29 | private string _title = "Prism Serilog WPF Demo (.NET Core 3.0)";
30 |
31 | public MainWindowViewModel(ILoggerFacade logger)
32 | {
33 | _logger = logger ?? throw new ArgumentNullException(nameof(logger));
34 |
35 | LogDebugCommand = new DelegateCommand(LogDebug);
36 | LogInformationCommand = new DelegateCommand(LogInformation);
37 | LogWarningCommand = new DelegateCommand(LogWarning);
38 | LogExceptionCommand = new DelegateCommand(LogException);
39 | }
40 |
41 | public string Title
42 | {
43 | get => _title;
44 | set => SetProperty(ref _title, value);
45 | }
46 |
47 | public string Text
48 | {
49 | get
50 | {
51 | const string logFileName = "DemoLog.txt";
52 |
53 | if (!File.Exists(logFileName))
54 | {
55 | return null;
56 | }
57 |
58 | // FileShare.ReadWrite required for Serilog to continue writing - File.ReadAllText doesn't allow that
59 | using (var stream = new FileStream(logFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
60 | {
61 | using (var reader = new StreamReader(stream, Encoding.UTF8, detectEncodingFromByteOrderMarks: true))
62 | {
63 | return reader.ReadToEnd();
64 | }
65 | }
66 | }
67 | }
68 |
69 | public DelegateCommand LogDebugCommand { get; }
70 | public DelegateCommand LogInformationCommand { get; }
71 | public DelegateCommand LogWarningCommand { get; }
72 | public DelegateCommand LogExceptionCommand { get; }
73 |
74 | private void LogDebug()
75 | {
76 | _logger.Log("This is a Debug message!", Category.Debug, Priority.High);
77 |
78 | RaisePropertyChanged(nameof(Text));
79 | }
80 |
81 | private void LogInformation()
82 | {
83 | _logger.Log("This is an Information message!", Category.Info, Priority.High);
84 |
85 | RaisePropertyChanged(nameof(Text));
86 | }
87 |
88 | private void LogWarning()
89 | {
90 | _logger.Log("This is an Warning message!", Category.Warn, Priority.High);
91 |
92 | RaisePropertyChanged(nameof(Text));
93 | }
94 |
95 | private void LogException()
96 | {
97 | _logger.Log("This is an Exception message!", Category.Exception, Priority.High);
98 |
99 | RaisePropertyChanged(nameof(Text));
100 | }
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/sample/netcoreapp3.0/PrismSerilogWpfDemoNetCoreApp30/Views/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 | Log messages are being written to `DemoLog.txt`
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/sample/netcoreapp3.0/PrismSerilogWpfDemoNetCoreApp30/Views/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | #region Copyright 2019-2023 C. Augusto Proiete & Contributors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | #endregion
16 |
17 | using System.Windows;
18 |
19 | namespace PrismSerilogWpfDemoNetCoreApp30.Views
20 | {
21 | public partial class MainWindow : Window
22 | {
23 | public MainWindow()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/AndroidInitializer.cs:
--------------------------------------------------------------------------------
1 | #region Copyright 2019-2023 C. Augusto Proiete & Contributors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | #endregion
16 |
17 | using Android.Provider;
18 | using Java.IO;
19 | using Java.Lang;
20 | using Prism;
21 | using Prism.Ioc;
22 | using Serilog;
23 |
24 | namespace PrismSerilogXamarinDemoNetStandard20.Droid
25 | {
26 | public class AndroidInitializer : IPlatformInitializer
27 | {
28 | public void RegisterTypes(IContainerRegistry containerRegistry)
29 | {
30 | // Register any platform specific implementations
31 |
32 | var stringBuilder = new System.Text.StringBuilder();
33 | var messages = new System.IO.StringWriter(stringBuilder);
34 | Log.Logger =
35 | new LoggerConfiguration()
36 | .WriteTo.AndroidLog()
37 | .WriteTo.TextWriter(messages)
38 | .MinimumLevel.Debug()
39 | .CreateLogger();
40 |
41 | containerRegistry.RegisterInstance(messages);
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Assets/AboutAssets.txt:
--------------------------------------------------------------------------------
1 | Any raw assets you want to be deployed with your application can be placed in
2 | this directory (and child directories) and given a Build Action of "AndroidAsset".
3 |
4 | These files will be deployed with your package and will be accessible using Android's
5 | AssetManager, like this:
6 |
7 | public class ReadAsset : Activity
8 | {
9 | protected override void OnCreate (Bundle bundle)
10 | {
11 | base.OnCreate (bundle);
12 |
13 | InputStream input = Assets.Open ("my_asset.txt");
14 | }
15 | }
16 |
17 | Additionally, some Android functions will automatically load asset files:
18 |
19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
20 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/MainActivity.cs:
--------------------------------------------------------------------------------
1 | #region Copyright 2019-2023 C. Augusto Proiete & Contributors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | #endregion
16 |
17 | using System;
18 |
19 | using Android.App;
20 | using Android.Content.PM;
21 | using Android.Runtime;
22 | using Android.Views;
23 | using Android.Widget;
24 | using Android.OS;
25 |
26 | namespace PrismSerilogXamarinDemoNetStandard20.Droid
27 | {
28 | [Activity(Label = "PrismSerilogXamarinDemoNetStandard20", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
29 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
30 | {
31 | protected override void OnCreate(Bundle savedInstanceState)
32 | {
33 | TabLayoutResource = Resource.Layout.Tabbar;
34 | ToolbarResource = Resource.Layout.Toolbar;
35 |
36 | base.OnCreate(savedInstanceState);
37 |
38 | Xamarin.Essentials.Platform.Init(this, savedInstanceState);
39 | global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
40 | LoadApplication(new App());
41 | }
42 | public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
43 | {
44 | Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
45 |
46 | base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/PrismSerilogXamarinDemoNetStandard20.Android.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 | {4D03E699-7664-42A4-8A4C-03E69830B120}
7 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
8 | {c9e5eea5-ca05-42a1-839b-61506e0a37df}
9 | Library
10 | PrismSerilogXamarinDemoNetStandard20.Droid
11 | PrismSerilogXamarinDemoNetStandard20.Android
12 | True
13 | True
14 | Resources\Resource.designer.cs
15 | Resource
16 | Properties\AndroidManifest.xml
17 | Resources
18 | Assets
19 | v9.0
20 | true
21 | true
22 | Xamarin.Android.Net.AndroidClientHandler
23 |
24 |
25 |
26 |
27 | true
28 | portable
29 | false
30 | bin\Debug
31 | DEBUG;
32 | prompt
33 | 4
34 | None
35 |
36 |
37 | true
38 | portable
39 | true
40 | bin\Release
41 | prompt
42 | 4
43 | true
44 | false
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 7.2.0.1422
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 | {175A4224-8499-4AAE-B3CB-EB82649F8D07}
99 | PrismSerilogXamarinDemoNetStandard20
100 |
101 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Properties/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using Android.App;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 | [assembly: AssemblyTitle("PrismSerilogXamarinDemoNetStandard20.Android")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("PrismSerilogXamarinDemoNetStandard20.Android")]
14 | [assembly: AssemblyCopyright("Copyright 2014-2020 C. Augusto Proiete & Contributors")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 | [assembly: ComVisible(false)]
18 |
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | [assembly: AssemblyVersion("1.0.0.0")]
26 | [assembly: AssemblyFileVersion("1.0.0.0")]
27 |
28 | // Add some common permissions, these can be removed if not needed
29 | [assembly: UsesPermission(Android.Manifest.Permission.Internet)]
30 | [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
31 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/AboutResources.txt:
--------------------------------------------------------------------------------
1 | Images, layout descriptions, binary blobs and string dictionaries can be included
2 | in your application as resource files. Various Android APIs are designed to
3 | operate on the resource IDs instead of dealing with images, strings or binary blobs
4 | directly.
5 |
6 | For example, a sample Android app that contains a user interface layout (main.xml),
7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
8 | would keep its resources in the "Resources" directory of the application:
9 |
10 | Resources/
11 | drawable-hdpi/
12 | icon.png
13 |
14 | drawable-ldpi/
15 | icon.png
16 |
17 | drawable-mdpi/
18 | icon.png
19 |
20 | layout/
21 | main.xml
22 |
23 | values/
24 | strings.xml
25 |
26 | In order to get the build system to recognize Android resources, set the build action to
27 | "AndroidResource". The native Android APIs do not operate directly with filenames, but
28 | instead operate on resource IDs. When you compile an Android application that uses resources,
29 | the build system will package the resources for distribution and generate a class called
30 | "Resource" that contains the tokens for each one of the resources included. For example,
31 | for the above Resources layout, this is what the Resource class would expose:
32 |
33 | public class Resource {
34 | public class drawable {
35 | public const int icon = 0x123;
36 | }
37 |
38 | public class layout {
39 | public const int main = 0x456;
40 | }
41 |
42 | public class strings {
43 | public const int first_string = 0xabc;
44 | public const int second_string = 0xbcd;
45 | }
46 | }
47 |
48 | You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main
49 | to reference the layout/main.xml file, or Resource.strings.first_string to reference the first
50 | string in the dictionary file values/strings.xml.
51 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/layout/Tabbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/layout/Toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-anydpi-v26/icon.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-anydpi-v26/icon_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-hdpi/icon.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-hdpi/launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-hdpi/launcher_foreground.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-mdpi/icon.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-mdpi/launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-mdpi/launcher_foreground.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-xhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-xhdpi/icon.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-xhdpi/launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-xhdpi/launcher_foreground.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-xxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-xxhdpi/icon.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-xxhdpi/launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-xxhdpi/launcher_foreground.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-xxxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-xxxhdpi/icon.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFFFFF
4 | #3F51B5
5 | #303F9F
6 | #FF4081
7 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.Android/Resources/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
24 |
27 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/AppDelegate.cs:
--------------------------------------------------------------------------------
1 | #region Copyright 2019-2023 C. Augusto Proiete & Contributors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | #endregion
16 |
17 | using System;
18 | using System.Collections.Generic;
19 | using System.Linq;
20 |
21 | using Foundation;
22 | using UIKit;
23 |
24 | namespace PrismSerilogXamarinDemoNetStandard20.iOS
25 | {
26 | // The UIApplicationDelegate for the application. This class is responsible for launching the
27 | // User Interface of the application, as well as listening (and optionally responding) to
28 | // application events from iOS.
29 | [Register("AppDelegate")]
30 | public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
31 | {
32 | //
33 | // This method is invoked when the application has loaded and is ready to run. In this
34 | // method you should instantiate the window, load the UI into it and then make the window
35 | // visible.
36 | //
37 | // You have 17 seconds to return from this method, or iOS will terminate your application.
38 | //
39 | public override bool FinishedLaunching(UIApplication app, NSDictionary options)
40 | {
41 | global::Xamarin.Forms.Forms.Init();
42 | LoadApplication(new App(new iOSInitializer()));
43 |
44 | return base.FinishedLaunching(app, options);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images": [
3 | {
4 | "scale": "2x",
5 | "size": "20x20",
6 | "idiom": "iphone",
7 | "filename": "Icon40.png"
8 | },
9 | {
10 | "scale": "3x",
11 | "size": "20x20",
12 | "idiom": "iphone",
13 | "filename": "Icon60.png"
14 | },
15 | {
16 | "scale": "2x",
17 | "size": "29x29",
18 | "idiom": "iphone",
19 | "filename": "Icon58.png"
20 | },
21 | {
22 | "scale": "3x",
23 | "size": "29x29",
24 | "idiom": "iphone",
25 | "filename": "Icon87.png"
26 | },
27 | {
28 | "scale": "2x",
29 | "size": "40x40",
30 | "idiom": "iphone",
31 | "filename": "Icon80.png"
32 | },
33 | {
34 | "scale": "3x",
35 | "size": "40x40",
36 | "idiom": "iphone",
37 | "filename": "Icon120.png"
38 | },
39 | {
40 | "scale": "2x",
41 | "size": "60x60",
42 | "idiom": "iphone",
43 | "filename": "Icon120.png"
44 | },
45 | {
46 | "scale": "3x",
47 | "size": "60x60",
48 | "idiom": "iphone",
49 | "filename": "Icon180.png"
50 | },
51 | {
52 | "scale": "1x",
53 | "size": "20x20",
54 | "idiom": "ipad",
55 | "filename": "Icon20.png"
56 | },
57 | {
58 | "scale": "2x",
59 | "size": "20x20",
60 | "idiom": "ipad",
61 | "filename": "Icon40.png"
62 | },
63 | {
64 | "scale": "1x",
65 | "size": "29x29",
66 | "idiom": "ipad",
67 | "filename": "Icon29.png"
68 | },
69 | {
70 | "scale": "2x",
71 | "size": "29x29",
72 | "idiom": "ipad",
73 | "filename": "Icon58.png"
74 | },
75 | {
76 | "scale": "1x",
77 | "size": "40x40",
78 | "idiom": "ipad",
79 | "filename": "Icon40.png"
80 | },
81 | {
82 | "scale": "2x",
83 | "size": "40x40",
84 | "idiom": "ipad",
85 | "filename": "Icon80.png"
86 | },
87 | {
88 | "scale": "1x",
89 | "size": "76x76",
90 | "idiom": "ipad",
91 | "filename": "Icon76.png"
92 | },
93 | {
94 | "scale": "2x",
95 | "size": "76x76",
96 | "idiom": "ipad",
97 | "filename": "Icon152.png"
98 | },
99 | {
100 | "scale": "2x",
101 | "size": "83.5x83.5",
102 | "idiom": "ipad",
103 | "filename": "Icon167.png"
104 | },
105 | {
106 | "scale": "1x",
107 | "size": "1024x1024",
108 | "idiom": "ios-marketing",
109 | "filename": "Icon1024.png"
110 | }
111 | ],
112 | "properties": {},
113 | "info": {
114 | "version": 1,
115 | "author": "xcode"
116 | }
117 | }
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Entitlements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | UIDeviceFamily
6 |
7 | 1
8 | 2
9 |
10 | UISupportedInterfaceOrientations
11 |
12 | UIInterfaceOrientationPortrait
13 | UIInterfaceOrientationLandscapeLeft
14 | UIInterfaceOrientationLandscapeRight
15 |
16 | UISupportedInterfaceOrientations~ipad
17 |
18 | UIInterfaceOrientationPortrait
19 | UIInterfaceOrientationPortraitUpsideDown
20 | UIInterfaceOrientationLandscapeLeft
21 | UIInterfaceOrientationLandscapeRight
22 |
23 | MinimumOSVersion
24 | 8.0
25 | CFBundleDisplayName
26 | PrismSerilogXamarinDemoNetStandard20
27 | CFBundleIdentifier
28 | com.prism.logging.serilog.FormsExample
29 | CFBundleVersion
30 | 1.0
31 | UILaunchStoryboardName
32 | LaunchScreen
33 | CFBundleName
34 | PrismSerilogXamarinDemoNetStandard20
35 | XSAppIconAssets
36 | Assets.xcassets/AppIcon.appiconset
37 |
38 |
39 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Main.cs:
--------------------------------------------------------------------------------
1 | #region Copyright 2019-2023 C. Augusto Proiete & Contributors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | #endregion
16 |
17 | using System;
18 | using System.Collections.Generic;
19 | using System.Linq;
20 |
21 | using Foundation;
22 | using UIKit;
23 |
24 | namespace PrismSerilogXamarinDemoNetStandard20.iOS
25 | {
26 | public class Application
27 | {
28 | // This is the main entry point of the application.
29 | static void Main(string[] args)
30 | {
31 | // if you want to use a different Application Delegate class from "AppDelegate"
32 | // you can specify it here.
33 | UIApplication.Main(args, null, "AppDelegate");
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/PrismSerilogXamarinDemoNetStandard20.iOS.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | iPhoneSimulator
6 | 8.0.30703
7 | 2.0
8 | {C2327E37-42DC-4154-95DA-47CBC123890F}
9 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
10 | {6143fdea-f3c2-4a09-aafa-6e230626515e}
11 | Exe
12 | PrismSerilogXamarinDemoNetStandard20.iOS
13 | Resources
14 | PrismSerilogXamarinDemoNetStandard20.iOS
15 | true
16 | NSUrlSessionHandler
17 | automatic
18 |
19 |
20 | true
21 | full
22 | false
23 | bin\iPhoneSimulator\Debug
24 | DEBUG
25 | prompt
26 | 4
27 | x86_64
28 | None
29 | true
30 |
31 |
32 | none
33 | true
34 | bin\iPhoneSimulator\Release
35 | prompt
36 | 4
37 | None
38 | x86_64
39 |
40 |
41 | true
42 | full
43 | false
44 | bin\iPhone\Debug
45 | DEBUG
46 | prompt
47 | 4
48 | ARM64
49 | iPhone Developer
50 | true
51 | Entitlements.plist
52 | None
53 | -all
54 |
55 |
56 | none
57 | true
58 | bin\iPhone\Release
59 | prompt
60 | 4
61 | ARM64
62 | iPhone Developer
63 | Entitlements.plist
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | false
77 |
78 |
79 | false
80 |
81 |
82 | false
83 |
84 |
85 | false
86 |
87 |
88 | false
89 |
90 |
91 | false
92 |
93 |
94 | false
95 |
96 |
97 | false
98 |
99 |
100 | false
101 |
102 |
103 | false
104 |
105 |
106 | false
107 |
108 |
109 | false
110 |
111 |
112 | false
113 |
114 |
115 | false
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 | 7.2.0.1422
133 |
134 |
135 |
136 |
137 |
138 | {175A4224-8499-4AAE-B3CB-EB82649F8D07}
139 | PrismSerilogXamarinDemoNetStandard20
140 |
141 |
142 |
143 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("PrismSerilogXamarinDemoNetStandard20.iOS")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("PrismSerilogXamarinDemoNetStandard20.iOS")]
13 | [assembly: AssemblyCopyright("Copyright 2014-2020 C. Augusto Proiete & Contributors")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Resources/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Resources/Default-568h@2x.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Resources/Default-Portrait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Resources/Default-Portrait.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Resources/Default-Portrait@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Resources/Default-Portrait@2x.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Resources/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Resources/Default.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Resources/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/fbde3da757c845976e77dd24991ddf692572704b/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Resources/Default@2x.png
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/Resources/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
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 |
38 |
39 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.iOS/iOSInitializer.cs:
--------------------------------------------------------------------------------
1 | #region Copyright 2019-2023 C. Augusto Proiete & Contributors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | #endregion
16 |
17 | using Prism;
18 | using Prism.Ioc;
19 | using Serilog;
20 | using Serilog.Core;
21 |
22 | namespace PrismSerilogXamarinDemoNetStandard20.iOS
23 | {
24 | public class iOSInitializer : IPlatformInitializer
25 | {
26 | public void RegisterTypes(IContainerRegistry containerRegistry)
27 | {
28 | // Register any platform specific implementations
29 |
30 | var stringBuilder = new System.Text.StringBuilder();
31 | var messages = new System.IO.StringWriter(stringBuilder);
32 | Log.Logger =
33 | new LoggerConfiguration()
34 | .WriteTo.NSLog()
35 | .WriteTo.TextWriter(messages)
36 | .MinimumLevel.Debug()
37 | .CreateLogger();
38 | containerRegistry.RegisterInstance(messages);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20/App.xaml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20/App.xaml.cs:
--------------------------------------------------------------------------------
1 | #region Copyright 2019-2023 C. Augusto Proiete & Contributors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | #endregion
16 |
17 | using System;
18 | using System.Diagnostics;
19 | using Prism;
20 | using Prism.DryIoc;
21 | using Prism.Ioc;
22 | using PrismSerilogXamarinDemoNetStandard20.ViewModels;
23 | using Serilog;
24 | using Xamarin.Forms;
25 | using Xamarin.Forms.Xaml;
26 |
27 | namespace PrismSerilogXamarinDemoNetStandard20
28 | {
29 | public partial class App
30 | {
31 | /*
32 | * The Xamarin Forms XAML Previewer in Visual Studio uses System.Activator.CreateInstance.
33 | * This imposes a limitation in which the App class must have a default constructor.
34 | * App(IPlatformInitializer initializer = null) cannot be handled by the Activator.
35 | */
36 | public App() : this(null)
37 | {
38 | }
39 |
40 | public App(IPlatformInitializer initializer)
41 | : base(initializer)
42 | {
43 | }
44 |
45 | protected override async void OnInitialized()
46 | {
47 | InitializeComponent();
48 | //await NavigateToTabbedPage();
49 | await NavigationService.NavigateAsync("MainPage");
50 | }
51 |
52 | protected override void RegisterTypes(IContainerRegistry containerRegistry)
53 | {
54 | containerRegistry.RegisterForNavigation();
55 | containerRegistry.RegisterSerilog(Log.Logger);
56 | }
57 |
58 | protected override void OnStart()
59 | {
60 | }
61 |
62 | protected override void OnSleep()
63 | {
64 | }
65 |
66 | protected override void OnResume()
67 | {
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using Xamarin.Forms.Xaml;
2 |
3 | [assembly: XamlCompilation(XamlCompilationOptions.Compile)]
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | true
6 |
7 |
8 |
9 | portable
10 | true
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | Designer
27 | MSBuild:UpdateDesignTimeXaml
28 |
29 |
30 |
31 |
32 |
33 | MainPage.xaml
34 | Code
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20/ViewModels/MainPageViewModel.cs:
--------------------------------------------------------------------------------
1 | #region Copyright 2019-2023 C. Augusto Proiete & Contributors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | #endregion
16 |
17 | using System;
18 | using System.IO;
19 | using System.Text;
20 | using Prism.Commands;
21 | using Prism.Logging;
22 | using Prism.Mvvm;
23 |
24 | namespace PrismSerilogXamarinDemoNetStandard20.ViewModels
25 | {
26 | public class MainPageViewModel : BindableBase
27 | {
28 | private ILoggerFacade _logger;
29 | private readonly StringWriter _stringWriter;
30 | private readonly StringBuilder _stringBuilder;
31 |
32 | public MainPageViewModel(ILoggerFacade logger, StringWriter stringWriter)
33 | {
34 | _stringBuilder = stringWriter.GetStringBuilder();
35 |
36 | _logger = logger ?? throw new ArgumentNullException(nameof(logger));
37 | _stringWriter = stringWriter;
38 |
39 | LogDebugCommand = new DelegateCommand(LogDebug);
40 | LogInformationCommand = new DelegateCommand(LogInformation);
41 | LogWarningCommand = new DelegateCommand(LogWarning);
42 | LogExceptionCommand = new DelegateCommand(LogException);
43 | }
44 |
45 | public DelegateCommand LogExceptionCommand { get; set; }
46 |
47 | public DelegateCommand LogWarningCommand { get; set; }
48 |
49 | public DelegateCommand LogInformationCommand { get; set; }
50 |
51 | public DelegateCommand LogDebugCommand { get; set; }
52 |
53 | public string Text => _stringBuilder.ToString();
54 |
55 | private void LogDebug()
56 | {
57 | _logger.Log("Debug from Serilog!", Category.Debug, Priority.High);
58 |
59 | RaisePropertyChanged(nameof(Text));
60 | }
61 |
62 | private void LogInformation()
63 | {
64 | _logger.Log("Information from Serilog!", Category.Info, Priority.High);
65 |
66 | RaisePropertyChanged(nameof(Text));
67 | }
68 |
69 | private void LogWarning()
70 | {
71 | _logger.Log("Warning from Serilog!", Category.Warn, Priority.High);
72 |
73 | RaisePropertyChanged(nameof(Text));
74 | }
75 |
76 | private void LogException()
77 | {
78 | _logger.Log("Exception from Serilog!", Category.Exception, Priority.High);
79 |
80 | RaisePropertyChanged(nameof(Text));
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20/Views/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/sample/netstandard2.0/PrismSerilogXamarinDemoNetStandard20/PrismSerilogXamarinDemoNetStandard20/Views/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | #region Copyright 2019-2023 C. Augusto Proiete & Contributors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | #endregion
16 |
17 | using System;
18 | using System.Collections.Generic;
19 | using System.ComponentModel;
20 | using System.Linq;
21 | using System.Text;
22 | using System.Threading.Tasks;
23 | using Xamarin.Forms;
24 |
25 | namespace PrismSerilogXamarinDemoNetStandard20
26 | {
27 | // Learn more about making custom code visible in the Xamarin.Forms previewer
28 | // by visiting https://aka.ms/xamarinforms-previewer
29 | [DesignTimeVisible(false)]
30 | public partial class MainPage : ContentPage
31 | {
32 | public MainPage()
33 | {
34 | InitializeComponent();
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/Prism.Logging.Serilog/Ioc/IContainerRegistryExtensions.cs:
--------------------------------------------------------------------------------
1 | #region Copyright 2019-2023 C. Augusto Proiete & Contributors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | #endregion
16 |
17 | using System;
18 | using Prism.Logging;
19 | using Prism.Logging.Serilog;
20 | using Serilog;
21 |
22 | namespace Prism.Ioc
23 | {
24 | ///
25 | /// Extends with methods to register
26 | /// with Prism.
27 | ///
28 | // ReSharper disable once InconsistentNaming
29 | public static class IContainerRegistryExtensions
30 | {
31 | ///
32 | /// Register a instance
33 | /// with Prism, which will forward log messages from Prism to Serilog
34 | ///
35 | /// Prism container registry
36 | public static void RegisterSerilog(this IContainerRegistry containerRegistry)
37 | {
38 | RegisterSerilog(containerRegistry, Log.Logger);
39 | }
40 |
41 | ///
42 | /// Register a instance
43 | /// with Prism, which will forward log messages from Prism to Serilog
44 | ///
45 | /// Prism container registry.
46 | /// Serilog logger instance to forward the message to.
47 | /// (Optional) Prism logger façade instance to forward the message to.
48 | public static void RegisterSerilog(this IContainerRegistry containerRegistry, ILogger logger, ILoggerFacade next = null)
49 | {
50 | if (containerRegistry == null) throw new ArgumentNullException(nameof(containerRegistry));
51 |
52 | containerRegistry.RegisterInstance(new SerilogLoggerFacade(logger, next));
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/Prism.Logging.Serilog/Logging/Serilog/SerilogLoggerFacade.cs:
--------------------------------------------------------------------------------
1 | #region Copyright 2019-2023 C. Augusto Proiete & Contributors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | #endregion
16 |
17 | using System;
18 | using Serilog;
19 |
20 | namespace Prism.Logging.Serilog
21 | {
22 | ///
23 | /// Forwards logs from Prism to Serilog
24 | ///
25 | public class SerilogLoggerFacade : ILoggerFacade
26 | {
27 | private readonly ILogger _loggerPriorityNone;
28 | private readonly ILogger _loggerPriorityHigh;
29 | private readonly ILogger _loggerPriorityMedium;
30 | private readonly ILogger _loggerPriorityLow;
31 |
32 | private readonly ILoggerFacade _next;
33 |
34 | ///
35 | /// Construct a that
36 | /// forwards logs to .
37 | ///
38 | public SerilogLoggerFacade()
39 | : this(global::Serilog.Log.Logger)
40 | {
41 | }
42 |
43 | ///
44 | /// Construct a that
45 | /// that forwards logs to the injected.
46 | ///
47 | /// Serilog logger instance to forward the message to.
48 | /// (Optional) Prism logger façade instance to forward the message to.
49 | public SerilogLoggerFacade(ILogger logger, ILoggerFacade next = null)
50 | {
51 | if (logger == null) throw new ArgumentNullException(nameof(logger));
52 |
53 | var contextLogger = logger.ForContext();
54 | _loggerPriorityNone = contextLogger.ForContext(nameof(Priority), nameof(Priority.None));
55 | _loggerPriorityHigh = contextLogger.ForContext(nameof(Priority), nameof(Priority.High));
56 | _loggerPriorityMedium = contextLogger.ForContext(nameof(Priority), nameof(Priority.Medium));
57 | _loggerPriorityLow = contextLogger.ForContext(nameof(Priority), nameof(Priority.Low));
58 |
59 | _next = next;
60 | }
61 |
62 | ///
63 | public void Log(string message, Category category, Priority priority)
64 | {
65 | ILogger logger;
66 |
67 | switch (priority)
68 | {
69 | case Priority.None:
70 | logger = _loggerPriorityNone;
71 | break;
72 | case Priority.High:
73 | logger = _loggerPriorityHigh;
74 | break;
75 | case Priority.Medium:
76 | logger = _loggerPriorityMedium;
77 | break;
78 | case Priority.Low:
79 | logger = _loggerPriorityLow;
80 | break;
81 | default:
82 | throw new ArgumentOutOfRangeException(nameof(priority), priority, $"Unknown {nameof(Priority)}: `{priority}`");
83 | }
84 |
85 | switch (category)
86 | {
87 | case Category.Debug:
88 | logger.Debug(message);
89 | break;
90 | case Category.Info:
91 | logger.Information(message);
92 | break;
93 | case Category.Warn:
94 | logger.Warning(message);
95 | break;
96 | case Category.Exception:
97 | logger.Error(message);
98 | break;
99 | default:
100 | throw new ArgumentOutOfRangeException(nameof(category), category, $"Unknown {nameof(Category)}: `{category}`");
101 | }
102 |
103 | _next?.Log(message, category, priority);
104 | }
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/src/Prism.Logging.Serilog/Prism.Logging.Serilog.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Integrate Serilog with Prism in your WPF, UWP, or Xamarin Forms apps.
5 | 7.2.0.1423
6 | C. Augusto Proiete and Contributors
7 | net45;netstandard2.0;netcoreapp3.0
8 | Prism.Logging.Serilog
9 | ../../assets/prism.snk
10 | true
11 | true
12 | Prism.Logging.Serilog
13 | prism;serilog;sinks;logging;wpf;xamarin;mvvm;uwp;uap;xaml
14 | https://raw.githubusercontent.com/augustoproiete/prism-logging-serilog/master/assets/prism-nuget.png
15 | https://github.com/augustoproiete/prism-logging-serilog
16 | https://github.com/augustoproiete/prism-logging-serilog/releases/tag/v$(VersionPrefix)
17 | Apache-2.0
18 | https://github.com/augustoproiete/prism-logging-serilog
19 | git
20 | true
21 | snupkg
22 | true
23 | true
24 | true
25 |
26 | true
27 | $(NoWarn);NU5048
28 | True
29 |
30 | Prism
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/test/Prism.Logging.Serilog.Tests/Prism.Logging.Serilog.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.0
5 | Prism.Logging.Serilog.Tests
6 | Prism.Logging.Serilog.Tests
7 | true
8 | 1.0.0
9 | false
10 | false
11 | false
12 | ../../assets/prism.snk
13 | true
14 | true
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/test/Prism.Logging.Serilog.Tests/SerilogLoggerFacadeTests.cs:
--------------------------------------------------------------------------------
1 | #region Copyright 2019-2023 C. Augusto Proiete & Contributors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | #endregion
16 |
17 | using System;
18 | using Serilog;
19 | using Serilog.Events;
20 | using Xunit;
21 | using Prism.Logging.Serilog.Tests.Support;
22 |
23 | namespace Prism.Logging.Serilog.Tests
24 | {
25 | public class SerilogLoggerFacadeTests
26 | {
27 | [Fact]
28 | public void Log_messages_of_Category_Debug_are_forwarded_to_Serilog_logger_as_Debug()
29 | {
30 | TestCategoryToLogEventLevelMap(Category.Debug, LogEventLevel.Debug);
31 | }
32 |
33 | [Fact]
34 | public void Log_messages_of_Category_Info_are_forwarded_to_Serilog_logger_as_Information()
35 | {
36 | TestCategoryToLogEventLevelMap(Category.Info, LogEventLevel.Information);
37 | }
38 |
39 | [Fact]
40 | public void Log_messages_of_Category_Warn_are_forwarded_to_Serilog_logger_as_Information()
41 | {
42 | TestCategoryToLogEventLevelMap(Category.Warn, LogEventLevel.Warning);
43 | }
44 |
45 | [Fact]
46 | public void Log_messages_of_Category_Exception_are_forwarded_to_Serilog_logger_as_Error()
47 | {
48 | TestCategoryToLogEventLevelMap(Category.Exception, LogEventLevel.Error);
49 | }
50 |
51 | [Fact]
52 | public void Log_messages_with_unknown_Category_throws_ArgumentOutOfRangeException()
53 | {
54 | LogEvent logEvent = null;
55 | var logger = DelegatingSink.GetLogger(le => logEvent = le);
56 |
57 | const string message = "This is an Exception message";
58 |
59 | var target = new SerilogLoggerFacade(logger);
60 |
61 | Assert.Throws(() => target.Log(message, (Category) (-1), Priority.None));
62 | Assert.Null(logEvent);
63 | }
64 |
65 | [Fact]
66 | public void Log_messages_have_SourceContext_set_to_SerilogLoggerFacade_FullName()
67 | {
68 | LogEvent logEvent = null;
69 | var logger = DelegatingSink.GetLogger(le => logEvent = le);
70 |
71 | var target = new SerilogLoggerFacade(logger);
72 | target.Log(string.Empty, Category.Exception, Priority.None);
73 |
74 | Assert.True(logEvent.Properties.ContainsKey("SourceContext"));
75 |
76 | var sourceContext = logEvent.Properties["SourceContext"].LiteralValue();
77 | Assert.Equal(typeof(SerilogLoggerFacade).FullName, sourceContext);
78 | }
79 |
80 | [Fact]
81 | public void Log_messages_with_Priority_None_are_forwarded_to_Serilog_logger_with_LogContext_property_Priority_with_value_None()
82 | {
83 | TestPriorityToPropertyMap(Priority.None, nameof(Priority), nameof(Priority.None));
84 | }
85 |
86 | [Fact]
87 | public void Log_messages_with_Priority_High_are_forwarded_to_Serilog_logger_with_LogContext_property_Priority_with_value_High()
88 | {
89 | TestPriorityToPropertyMap(Priority.High, nameof(Priority),nameof(Priority.High));
90 | }
91 |
92 | [Fact]
93 | public void Log_messages_with_Priority_Medium_are_forwarded_to_Serilog_logger_with_LogContext_property_Priority_with_value_Medium()
94 | {
95 | TestPriorityToPropertyMap(Priority.Medium, nameof(Priority), nameof(Priority.Medium));
96 | }
97 |
98 | [Fact]
99 | public void Log_messages_with_Priority_Low_are_forwarded_to_Serilog_logger_with_LogContext_property_Priority_with_value_Low()
100 | {
101 | TestPriorityToPropertyMap(Priority.Low, nameof(Priority), nameof(Priority.Low));
102 | }
103 |
104 | [Fact]
105 | public void Log_messages_are_forwarded_to_another_Prism_ILoggerFacade_if_one_is_provided()
106 | {
107 | var logger = new LoggerConfiguration().CreateLogger();
108 | var loggerFacade = new MockLoggerFacade();
109 |
110 | const string message = "This is an Exception message of High priority";
111 | const Category category = Category.Exception;
112 | const Priority priority = Priority.High;
113 |
114 | var target = new SerilogLoggerFacade(logger, loggerFacade);
115 | target.Log(message, category, priority);
116 |
117 | Assert.Equal(1, loggerFacade.Messages.Count);
118 | Assert.Equal(message, loggerFacade.Messages[0].Item1);
119 | Assert.Equal(category, loggerFacade.Messages[0].Item2);
120 | Assert.Equal(priority, loggerFacade.Messages[0].Item3);
121 | }
122 |
123 | [Fact]
124 | public void Serilog_Log_Logger_is_used_by_default_if_no_ILogger_injected_via_constructor()
125 | {
126 | LogEvent logEvent = null;
127 | Log.Logger = DelegatingSink.GetLogger(le => logEvent = le);
128 |
129 | const string message = "This is a Debug message";
130 |
131 | var target = new SerilogLoggerFacade();
132 | target.Log(message, Category.Debug, Priority.None);
133 |
134 | Assert.Equal(LogEventLevel.Debug, logEvent.Level);
135 | }
136 |
137 | private static void TestCategoryToLogEventLevelMap(Category category, LogEventLevel expectedLogEventLevel)
138 | {
139 | LogEvent logEvent = null;
140 | var logger = DelegatingSink.GetLogger(le => logEvent = le);
141 |
142 | var message = $"This is a {category} message";
143 |
144 | var target = new SerilogLoggerFacade(logger);
145 | target.Log(message, category, Priority.None);
146 |
147 | Assert.Equal(expectedLogEventLevel, logEvent.Level);
148 | Assert.Equal(message, logEvent.MessageTemplate.Text);
149 | }
150 |
151 | private static void TestPriorityToPropertyMap(Priority priority, string propertyName, string expectedValue)
152 | {
153 | LogEvent logEvent = null;
154 | var logger = DelegatingSink.GetLogger(le => logEvent = le);
155 |
156 | var target = new SerilogLoggerFacade(logger);
157 | target.Log(string.Empty, Category.Exception, priority);
158 |
159 | Assert.True(logEvent.Properties.ContainsKey(propertyName));
160 |
161 | var priorityValue = logEvent.Properties[propertyName].LiteralValue();
162 | Assert.Equal(expectedValue, priorityValue);
163 | }
164 | }
165 | }
166 |
--------------------------------------------------------------------------------
/test/Prism.Logging.Serilog.Tests/Support/DelegatingSink.cs:
--------------------------------------------------------------------------------
1 | #region Copyright 2019-2023 C. Augusto Proiete & Contributors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | #endregion
16 |
17 | using System;
18 | using Serilog;
19 | using Serilog.Core;
20 | using Serilog.Events;
21 |
22 | namespace Prism.Logging.Serilog.Tests.Support
23 | {
24 | internal class DelegatingSink : ILogEventSink
25 | {
26 | private readonly Action _writeAction;
27 |
28 | public DelegatingSink(Action writeAction)
29 | {
30 | _writeAction = writeAction ?? throw new ArgumentNullException(nameof(writeAction));
31 | }
32 |
33 | public void Emit(LogEvent logEvent)
34 | {
35 | _writeAction(logEvent);
36 | }
37 |
38 | public static ILogger GetLogger(Action writeAction)
39 | {
40 | var logger = new LoggerConfiguration()
41 | .MinimumLevel.Verbose()
42 | .WriteTo.Sink(new DelegatingSink(writeAction))
43 | .CreateLogger();
44 |
45 | return logger;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/test/Prism.Logging.Serilog.Tests/Support/Extensions.cs:
--------------------------------------------------------------------------------
1 | #region Copyright 2019-2023 C. Augusto Proiete & Contributors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | #endregion
16 |
17 | using Serilog.Events;
18 |
19 | namespace Prism.Logging.Serilog.Tests.Support
20 | {
21 | internal static class Extensions
22 | {
23 | public static object LiteralValue(this LogEventPropertyValue propertyValue)
24 | {
25 | return ((ScalarValue)propertyValue).Value;
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/test/Prism.Logging.Serilog.Tests/Support/MockLoggerFacade.cs:
--------------------------------------------------------------------------------
1 | #region Copyright 2019-2023 C. Augusto Proiete & Contributors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | //
15 | #endregion
16 |
17 | using System;
18 | using System.Collections.Generic;
19 |
20 | namespace Prism.Logging.Serilog.Tests.Support
21 | {
22 | internal class MockLoggerFacade : ILoggerFacade
23 | {
24 | public List> Messages { get; } =
25 | new List>();
26 |
27 | public void Log(string message, Category category, Priority priority)
28 | {
29 | Messages.Add(new Tuple(message, category, priority));
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------