diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml new file mode 100644 index 0000000..e987a52 --- /dev/null +++ b/.github/workflows/update-dependencies.yml @@ -0,0 +1,52 @@ +# Copyright (c) .NET Foundation and Contributors +# See LICENSE file in the project root for full license information. + +# This workflow will periodically check .NET nanoFramework dependencies and updates them in the repository it's running. + +name: Daily update dependencies + +on: + schedule: + # At 00:00 UTC every day. + - cron: '00 00 * * *' + repository_dispatch: + types: update-dependencies + +defaults: + run: + shell: pwsh + +jobs: + update-dotnet-preview: + name: Update .NET nanoFramework dependencies + timeout-minutes: 15 + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + path: main + - name: Checkout tools repo + uses: actions/checkout@v2 + with: + repository: nanoframework/nf-tools + path: tools + - name: Update dependencies + run: ./github-actions/update-nf-dependencies.ps1 + working-directory: tools + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + if: env.CREATE_PR == 'true' + with: + title: '${{ env.PR_TITLE }}' + body: | + ${{ env.PR_MESSAGE }} + + [version update] + + ### :warning: This is an automated update. :warning: + committer: 'nfbot ' + branch: ${{ env.BRANCH_NAME }} + path: main + labels: | + Type: dependencies diff --git a/.gitignore b/.gitignore index aee5823..83f4d69 100644 --- a/.gitignore +++ b/.gitignore @@ -255,3 +255,9 @@ paket-files/ #SoundCloud *.sonarqube/ + +#VS Code +.vscode + +#Sonar Lint +.sonarlint diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d5fab5f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,486 @@ +# Changelog + +## [**Changes available only in 'Preview' NuGet packages:**](https://github.com/nanoframework/nanoFramework.Logging/tree/HEAD) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.135...HEAD) + +**Documentation and other chores:** + +- Update 2 nuget dependencies [\#70](https://github.com/nanoframework/nanoFramework.Logging/pull/70) + +## [v1.0.0-preview.135](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.135) (2021-10-18) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.133...v1.0.0-preview.135) + +**Documentation and other chores:** + +- Update 2 nuget dependencies [\#69](https://github.com/nanoframework/nanoFramework.Logging/pull/69) + +## [v1.0.0-preview.133](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.133) (2021-10-15) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.131...v1.0.0-preview.133) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#68](https://github.com/nanoframework/nanoFramework.Logging/pull/68) + +## [v1.0.0-preview.131](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.131) (2021-09-30) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.129...v1.0.0-preview.131) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#64](https://github.com/nanoframework/nanoFramework.Logging/pull/64) + +## [v1.0.0-preview.129](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.129) (2021-09-27) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.127...v1.0.0-preview.129) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#63](https://github.com/nanoframework/nanoFramework.Logging/pull/63) + +## [v1.0.0-preview.127](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.127) (2021-09-26) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.122...v1.0.0-preview.127) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#62](https://github.com/nanoframework/nanoFramework.Logging/pull/62) +- Update 1 nuget dependencies [\#61](https://github.com/nanoframework/nanoFramework.Logging/pull/61) +- Update 1 nuget dependencies [\#60](https://github.com/nanoframework/nanoFramework.Logging/pull/60) + +## [v1.0.0-preview.122](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.122) (2021-07-18) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.120...v1.0.0-preview.122) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#59](https://github.com/nanoframework/nanoFramework.Logging/pull/59) + +## [v1.0.0-preview.120](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.120) (2021-07-17) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.118...v1.0.0-preview.120) + +**Documentation and other chores:** + +- Update 4 nuget dependencies [\#58](https://github.com/nanoframework/nanoFramework.Logging/pull/58) + +## [v1.0.0-preview.118](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.118) (2021-07-16) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.116...v1.0.0-preview.118) + +**Documentation and other chores:** + +- Update 4 nuget dependencies [\#57](https://github.com/nanoframework/nanoFramework.Logging/pull/57) + +## [v1.0.0-preview.116](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.116) (2021-07-15) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.114...v1.0.0-preview.116) + +**Documentation and other chores:** + +- Update 7 nuget dependencies [\#56](https://github.com/nanoframework/nanoFramework.Logging/pull/56) + +## [v1.0.0-preview.114](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.114) (2021-07-14) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.110...v1.0.0-preview.114) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#55](https://github.com/nanoframework/nanoFramework.Logging/pull/55) +- Update 1 nuget dependencies [\#54](https://github.com/nanoframework/nanoFramework.Logging/pull/54) +- Update 1 nuget dependencies [\#52](https://github.com/nanoframework/nanoFramework.Logging/pull/52) + +## [v1.0.0-preview.110](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.110) (2021-06-29) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.108...v1.0.0-preview.110) + +**Documentation and other chores:** + +- Update 2 nuget dependencies [\#51](https://github.com/nanoframework/nanoFramework.Logging/pull/51) + +## [v1.0.0-preview.108](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.108) (2021-06-27) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.106...v1.0.0-preview.108) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#50](https://github.com/nanoframework/nanoFramework.Logging/pull/50) + +## [v1.0.0-preview.106](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.106) (2021-06-21) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.104...v1.0.0-preview.106) + +**Documentation and other chores:** + +- Update 2 nuget dependencies [\#49](https://github.com/nanoframework/nanoFramework.Logging/pull/49) + +## [v1.0.0-preview.104](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.104) (2021-06-20) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.102...v1.0.0-preview.104) + +**Documentation and other chores:** + +- Update 5 nuget dependencies [\#48](https://github.com/nanoframework/nanoFramework.Logging/pull/48) + +## [v1.0.0-preview.102](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.102) (2021-06-19) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.100...v1.0.0-preview.102) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.10.5-preview.13 to 1.10.5-preview.18 [\#47](https://github.com/nanoframework/nanoFramework.Logging/pull/47) + +## [v1.0.0-preview.100](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.100) (2021-06-19) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.98...v1.0.0-preview.100) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#46](https://github.com/nanoframework/nanoFramework.Logging/pull/46) + +## [v1.0.0-preview.98](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.98) (2021-06-09) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.96...v1.0.0-preview.98) + +**Documentation and other chores:** + +- Update 3 nuget dependencies [\#45](https://github.com/nanoframework/nanoFramework.Logging/pull/45) + +## [v1.0.0-preview.96](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.96) (2021-06-08) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.94...v1.0.0-preview.96) + +**Documentation and other chores:** + +- Update 4 nuget dependencies [\#44](https://github.com/nanoframework/nanoFramework.Logging/pull/44) + +## [v1.0.0-preview.94](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.94) (2021-06-07) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.92...v1.0.0-preview.94) + +**Documentation and other chores:** + +- Update 3 NuGet dependencies [\#43](https://github.com/nanoframework/nanoFramework.Logging/pull/43) + +## [v1.0.0-preview.92](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.92) (2021-06-07) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.90...v1.0.0-preview.92) + +**Documentation and other chores:** + +- Update 3 nuget dependencies [\#42](https://github.com/nanoframework/nanoFramework.Logging/pull/42) + +## [v1.0.0-preview.90](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.90) (2021-06-06) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.88...v1.0.0-preview.90) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#41](https://github.com/nanoframework/nanoFramework.Logging/pull/41) + +## [v1.0.0-preview.88](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.88) (2021-06-05) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.86...v1.0.0-preview.88) + +**Documentation and other chores:** + +- Update 3 nuget dependencies [\#40](https://github.com/nanoframework/nanoFramework.Logging/pull/40) + +## [v1.0.0-preview.86](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.86) (2021-06-04) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.84...v1.0.0-preview.86) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#39](https://github.com/nanoframework/nanoFramework.Logging/pull/39) + +## [v1.0.0-preview.84](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.84) (2021-06-03) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.82...v1.0.0-preview.84) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.10.5-preview.4 to 1.10.5-preview.10 [\#38](https://github.com/nanoframework/nanoFramework.Logging/pull/38) + +## [v1.0.0-preview.82](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.82) (2021-06-03) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.80...v1.0.0-preview.82) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#37](https://github.com/nanoframework/nanoFramework.Logging/pull/37) + +## [v1.0.0-preview.80](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.80) (2021-06-02) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.78...v1.0.0-preview.80) + +**Documentation and other chores:** + +- Update 6 nuget dependencies [\#36](https://github.com/nanoframework/nanoFramework.Logging/pull/36) + +## [v1.0.0-preview.78](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.78) (2021-06-01) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.76...v1.0.0-preview.78) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#35](https://github.com/nanoframework/nanoFramework.Logging/pull/35) + +## [v1.0.0-preview.76](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.76) (2021-05-31) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.74...v1.0.0-preview.76) + +**Documentation and other chores:** + +- Bumps nanoFramework.TestFramework from 1.0.122 to 1.0.126 [\#34](https://github.com/nanoframework/nanoFramework.Logging/pull/34) + +## [v1.0.0-preview.74](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.74) (2021-05-31) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.72...v1.0.0-preview.74) + +**Documentation and other chores:** + +- Update 4 NuGet dependencies [\#33](https://github.com/nanoframework/nanoFramework.Logging/pull/33) + +## [v1.0.0-preview.72](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.72) (2021-05-31) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.70...v1.0.0-preview.72) + +**Documentation and other chores:** + +- Update 4 nuget dependencies [\#32](https://github.com/nanoframework/nanoFramework.Logging/pull/32) + +## [v1.0.0-preview.70](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.70) (2021-05-30) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.68...v1.0.0-preview.70) + +**Fixed bugs:** + +- Fixing nuget reference for Logging.Serial [\#31](https://github.com/nanoframework/nanoFramework.Logging/pull/31) + +## [v1.0.0-preview.68](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.68) (2021-05-30) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.66...v1.0.0-preview.68) + +**Documentation and other chores:** + +- Update 3 nuget dependencies [\#30](https://github.com/nanoframework/nanoFramework.Logging/pull/30) +- Update 1 nuget dependencies [\#29](https://github.com/nanoframework/nanoFramework.Logging/pull/29) + +## [v1.0.0-preview.66](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.66) (2021-05-29) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.64...v1.0.0-preview.66) + +**Implemented enhancements:** + +- Migrating to System.IO.Ports [\#28](https://github.com/nanoframework/nanoFramework.Logging/pull/28) + +## [v1.0.0-preview.64](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.64) (2021-05-27) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.62...v1.0.0-preview.64) + +**Documentation and other chores:** + +- Update 2 nuget dependencies [\#27](https://github.com/nanoframework/nanoFramework.Logging/pull/27) + +## [v1.0.0-preview.62](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.62) (2021-05-26) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.60...v1.0.0-preview.62) + +**Documentation and other chores:** + +- Update 3 nuget dependencies [\#26](https://github.com/nanoframework/nanoFramework.Logging/pull/26) + +## [v1.0.0-preview.60](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.60) (2021-05-25) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.58...v1.0.0-preview.60) + +**Documentation and other chores:** + +- Update 2 nuget dependencies [\#25](https://github.com/nanoframework/nanoFramework.Logging/pull/25) + +## [v1.0.0-preview.58](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.58) (2021-05-23) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.56...v1.0.0-preview.58) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#24](https://github.com/nanoframework/nanoFramework.Logging/pull/24) + +## [v1.0.0-preview.56](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.56) (2021-05-22) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.54...v1.0.0-preview.56) + +**Documentation and other chores:** + +- Update 2 nuget dependencies [\#23](https://github.com/nanoframework/nanoFramework.Logging/pull/23) + +## [v1.0.0-preview.54](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.54) (2021-05-21) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.52...v1.0.0-preview.54) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#22](https://github.com/nanoframework/nanoFramework.Logging/pull/22) + +## [v1.0.0-preview.52](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.52) (2021-05-20) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.50...v1.0.0-preview.52) + +**Documentation and other chores:** + +- Update 6 nuget dependencies [\#21](https://github.com/nanoframework/nanoFramework.Logging/pull/21) + +## [v1.0.0-preview.50](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.50) (2021-05-19) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.48...v1.0.0-preview.50) + +**Documentation and other chores:** + +- Update 4 NuGet dependencies [\#20](https://github.com/nanoframework/nanoFramework.Logging/pull/20) + +## [v1.0.0-preview.48](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.48) (2021-05-19) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.46...v1.0.0-preview.48) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.10.4-preview.4 to 1.10.4-preview.6 [\#19](https://github.com/nanoframework/nanoFramework.Logging/pull/19) + +## [v1.0.0-preview.46](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.46) (2021-05-16) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.44...v1.0.0-preview.46) + +**Documentation and other chores:** + +- Update 3 nuget dependencies [\#18](https://github.com/nanoframework/nanoFramework.Logging/pull/18) + +## [v1.0.0-preview.44](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.44) (2021-05-15) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.42...v1.0.0-preview.44) + +**Documentation and other chores:** + +- Update 5 nuget dependencies [\#17](https://github.com/nanoframework/nanoFramework.Logging/pull/17) + +## [v1.0.0-preview.42](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.42) (2021-05-14) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.40...v1.0.0-preview.42) + +**Documentation and other chores:** + +- Update 5 nuget dependencies [\#16](https://github.com/nanoframework/nanoFramework.Logging/pull/16) + +## [v1.0.0-preview.40](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.40) (2021-05-13) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.38...v1.0.0-preview.40) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.10.3-preview.20 to 1.10.4-preview.4 [\#15](https://github.com/nanoframework/nanoFramework.Logging/pull/15) + +## [v1.0.0-preview.38](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.38) (2021-05-12) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.36...v1.0.0-preview.38) + +**Documentation and other chores:** + +- Update 3 nuget dependencies [\#14](https://github.com/nanoframework/nanoFramework.Logging/pull/14) + +## [v1.0.0-preview.36](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.36) (2021-05-07) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.34...v1.0.0-preview.36) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#13](https://github.com/nanoframework/nanoFramework.Logging/pull/13) + +## [v1.0.0-preview.34](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.34) (2021-05-06) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.32...v1.0.0-preview.34) + +**Documentation and other chores:** + +- Update 5 nuget dependencies [\#12](https://github.com/nanoframework/nanoFramework.Logging/pull/12) + +## [v1.0.0-preview.32](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.32) (2021-05-05) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.30...v1.0.0-preview.32) + +**Documentation and other chores:** + +- Update 3 nuget dependencies [\#11](https://github.com/nanoframework/nanoFramework.Logging/pull/11) + +## [v1.0.0-preview.30](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.30) (2021-05-04) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.28...v1.0.0-preview.30) + +**Fixed bugs:** + +- Change Debug.WriteLine to Console.WriteLine [\#10](https://github.com/nanoframework/nanoFramework.Logging/pull/10) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#8](https://github.com/nanoframework/nanoFramework.Logging/pull/8) + +## [v1.0.0-preview.28](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.28) (2021-05-04) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.26...v1.0.0-preview.28) + +**Documentation and other chores:** + +- Bumps nanoFramework.CoreLibrary from 1.10.3-preview.7 to 1.10.3-preview.20 [\#9](https://github.com/nanoframework/nanoFramework.Logging/pull/9) + +## [v1.0.0-preview.26](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.26) (2021-04-23) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.25...v1.0.0-preview.26) + +**Documentation and other chores:** + +- Update 1 nuget dependencies [\#5](https://github.com/nanoframework/nanoFramework.Logging/pull/5) + +## [v1.0.0-preview.25](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.25) (2021-04-12) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.24...v1.0.0-preview.25) + +**Documentation and other chores:** + +- Update 2 nuget dependencies [\#4](https://github.com/nanoframework/nanoFramework.Logging/pull/4) + +## [v1.0.0-preview.24](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.24) (2021-04-10) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.21...v1.0.0-preview.24) + +**Implemented enhancements:** + +- Adding custom formatting for logs [\#1](https://github.com/nanoframework/nanoFramework.Logging/pull/1) + +**Documentation and other chores:** + +- Update 2 nuget dependencies [\#2](https://github.com/nanoframework/nanoFramework.Logging/pull/2) + +## [v1.0.0-preview.21](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.21) (2021-04-09) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.19...v1.0.0-preview.21) + +## [v1.0.0-preview.19](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.19) (2021-04-09) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.17...v1.0.0-preview.19) + +## [v1.0.0-preview.17](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.17) (2021-04-08) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.14...v1.0.0-preview.17) + +## [v1.0.0-preview.14](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.14) (2021-04-08) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/v1.0.0-preview.13...v1.0.0-preview.14) + +## [v1.0.0-preview.13](https://github.com/nanoframework/nanoFramework.Logging/tree/v1.0.0-preview.13) (2021-04-08) + +[Full Changelog](https://github.com/nanoframework/nanoFramework.Logging/compare/61794ede3f146bd8841c7e044f753c864648cbd5...v1.0.0-preview.13) + + + +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 7feff0a..7b41e31 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,3 +1,3 @@ # Contributor Code of Conduct -Please refer to the contributor Code of Conduct at the Home repository [here](https://github.com/nanoframework/Home/blob/master/CODE_OF_CONDUCT.md. +Please refer to the contributor Code of Conduct at the Home repository [here](https://github.com/nanoframework/Home/blob/main/CODE_OF_CONDUCT.md. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5a6a6c1..bf714b6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,3 @@ # Contributing to **nanoFramework** -Please refer to the contribution guidelines at the Home repository [here](https://github.com/nanoframework/Home/blob/master/CONTRIBUTING.md). +Please refer to the contribution guidelines at the Home repository [here](https://github.com/nanoframework/Home/blob/main/CONTRIBUTING.md). diff --git a/README.md b/README.md index 33ffb7e..d17d13e 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,21 @@ -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_nanoFramework.nanoFramework.Logging&metric=alert_status)](https://sonarcloud.io/dashboard?id=nanoframework_nanoFramework.nanoFramework.Logging) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_nanoFramework.nanoFramework.Logging&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=nanoframework_nanoFramework.nanoFramework.Logging) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![NuGet](https://img.shields.io/nuget/dt/nanoFramework.nanoFramework.Logging.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.nanoFramework.Logging/) [![#yourfirstpr](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://github.com/nanoframework/Home/blob/master/CONTRIBUTING.md) [![Discord](https://img.shields.io/discord/478725473862549535.svg?logo=discord&logoColor=white&label=Discord&color=7289DA)](https://discord.gg/gCyBu8T) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_nanoFramework.Logging&metric=alert_status)](https://sonarcloud.io/dashboard?id=nanoframework_nanoFramework.Logging) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_nanoFramework.Logging&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=nanoframework_nanoFramework.Logging) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![NuGet](https://img.shields.io/nuget/dt/nanoFramework.Logging.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.Logging/) [![#yourfirstpr](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://github.com/nanoframework/Home/blob/main/CONTRIBUTING.md) [![Discord](https://img.shields.io/discord/478725473862549535.svg?logo=discord&logoColor=white&label=Discord&color=7289DA)](https://discord.gg/gCyBu8T) -![nanoFramework logo](https://github.com/nanoframework/Home/blob/master/resources/logo/nanoFramework-repo-logo.png) +![nanoFramework logo](https://raw.githubusercontent.com/nanoframework/Home/main/resources/logo/nanoFramework-repo-logo.png) ----- -### Welcome to the **nanoFramework** nanoFramework.Logging Library repository! +### Welcome to the .NET **nanoFramework** nanoFramework.Logging Library repository ## Build status | Component | Build Status | NuGet Package | |:-|---|---| -| nanoFramework.Logging | [![Build Status](https://dev.azure.com/nanoframework/nanoFramework.nanoFramework.Logging/_apis/build/status/nanoframework.nanoFramework.nanoFramework.Logging?branchName=master)](https://dev.azure.com/nanoframework/nanoFramework.nanoFramework.Logging/_build/latest?definitionId=12?branchName=master) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.nanoFramework.Logging.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.nanoFramework.Logging/) | -| nanoFramework.Logging (preview) | [![Build Status](https://dev.azure.com/nanoframework/nanoFramework.nanoFramework.Logging/_apis/build/status/nanoframework.nanoFramework.nanoFramework.Logging?branchName=develop)](https://dev.azure.com/nanoframework/nanoFramework.nanoFramework.Logging/_build/latest?definitionId=12?branchName=develop) | [![](https://badgen.net/badge/NuGet/preview/D7B023?icon=https://simpleicons.now.sh/azuredevops/fff)](https://dev.azure.com/nanoframework/feed/_packaging?_a=package&feed=sandbox&package=nanoFramework.nanoFramework.Logging&protocolType=NuGet&view=overview) | -| nanoFramework.Logging.Serial | [![Build Status](https://dev.azure.com/nanoframework/nanoFramework.nanoFramework.Logging/_apis/build/status/nanoframework.nanoFramework.nanoFramework.Logging?branchName=master)](https://dev.azure.com/nanoframework/nanoFramework.nanoFramework.Logging/_build/latest?definitionId=12?branchName=master) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.nanoFramework.Logging.Serial.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.nanoFramework.Logging.Serial/) | -| nanoFramework.Logging.Serial (preview) | [![Build Status](https://dev.azure.com/nanoframework/nanoFramework.nanoFramework.Logging/_apis/build/status/nanoframework.nanoFramework.nanoFramework.Logging?branchName=develop)](https://dev.azure.com/nanoframework/nanoFramework.nanoFramework.Logging/_build/latest?definitionId=12?branchName=develop) | [![](https://badgen.net/badge/NuGet/preview/D7B023?icon=https://simpleicons.now.sh/azuredevops/fff)](https://dev.azure.com/nanoframework/feed/_packaging?_a=package&feed=sandbox&package=nanoFramework.nanoFramework.Logging.Serial&protocolType=NuGet&view=overview) | -| nanoFramework.Logging.Stream | [![Build Status](https://dev.azure.com/nanoframework/nanoFramework.nanoFramework.Logging/_apis/build/status/nanoframework.nanoFramework.nanoFramework.Logging?branchName=master)](https://dev.azure.com/nanoframework/nanoFramework.nanoFramework.Logging/_build/latest?definitionId=12?branchName=master) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.nanoFramework.Logging.Stream.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.nanoFramework.Logging.Stream/) | -| nanoFramework.Logging.Stream (preview) | [![Build Status](https://dev.azure.com/nanoframework/nanoFramework.nanoFramework.Logging/_apis/build/status/nanoframework.nanoFramework.nanoFramework.Logging?branchName=develop)](https://dev.azure.com/nanoframework/nanoFramework.nanoFramework.Logging/_build/latest?definitionId=12?branchName=develop) | [![](https://badgen.net/badge/NuGet/preview/D7B023?icon=https://simpleicons.now.sh/azuredevops/fff)](https://dev.azure.com/nanoframework/feed/_packaging?_a=package&feed=sandbox&package=nanoFramework.nanoFramework.Logging.Stream&protocolType=NuGet&view=overview) | +| nanoFramework.Logging | [![Build Status](https://dev.azure.com/nanoframework/nanoframework.Logging/_apis/build/status/nanoframework.nanoFramework.Logging?branchName=main)](https://dev.azure.com/nanoframework/nanoframework.Logging/_build/latest?definitionId=71&branchName=main) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.Logging.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.Logging/) | +| nanoFramework.Logging (preview) | [![Build Status](https://dev.azure.com/nanoframework/nanoframework.Logging/_apis/build/status/nanoframework.nanoFramework.Logging?branchName=develop)](https://dev.azure.com/nanoframework/nanoframework.Logging/_build/latest?definitionId=71&branchName=develop) | [![NuGet](https://img.shields.io/nuget/vpre/nanoFramework.Logging.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.Logging/) | +| nanoFramework.Logging.Serial | [![Build Status](https://dev.azure.com/nanoframework/nanoframework.Logging/_apis/build/status/nanoframework.nanoFramework.Logging?branchName=main)](https://dev.azure.com/nanoframework/nanoframework.Logging/_build/latest?definitionId=71&branchName=main) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.Logging.Serial.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.Logging.Serial/) | +| nanoFramework.Logging.Serial (preview) | [![Build Status](https://dev.azure.com/nanoframework/nanoframework.Logging/_apis/build/status/nanoframework.nanoFramework.Logging?branchName=develop)](https://dev.azure.com/nanoframework/nanoframework.Logging/_build/latest?definitionId=71&branchName=develop) | [![NuGet](https://img.shields.io/nuget/vpre/nanoFramework.Logging.Serial.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.Logging.Serial/) | +| nanoFramework.Logging.Stream | [![Build Status](https://dev.azure.com/nanoframework/nanoframework.Logging/_apis/build/status/nanoframework.nanoFramework.Logging?branchName=main)](https://dev.azure.com/nanoframework/nanoframework.Logging/_build/latest?definitionId=71&branchName=main) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.Logging.Stream.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.Logging.Stream/) | +| nanoFramework.Logging.Stream (preview) | [![Build Status](https://dev.azure.com/nanoframework/nanoframework.Logging/_apis/build/status/nanoframework.nanoFramework.Logging?branchName=develop)](https://dev.azure.com/nanoframework/nanoframework.Logging/_build/latest?definitionId=71&branchName=develop) | [![NuGet](https://img.shields.io/nuget/vpre/nanoFramework.Logging.Stream.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.Logging.Stream/) | ## Feedback and documentation @@ -26,7 +26,7 @@ Join our Discord community [here](https://discord.gg/gCyBu8T). ## Credits -The list of contributors to this project can be found at [CONTRIBUTORS](https://github.com/nanoframework/Home/blob/master/CONTRIBUTORS.md). +The list of contributors to this project can be found at [CONTRIBUTORS](https://github.com/nanoframework/Home/blob/main/CONTRIBUTORS.md). ## License @@ -109,8 +109,8 @@ Note that you can adjust the baud speed and all other elements. Or directly using a SerialLogger: ```csharp -SerialDevice _serial; -_serial = SerialDevice.FromId("COM6", 115200); +SerialPort _serial; +_serial = new SerialPort("COM6", 115200); SerialLogger _logger = new SerialLogger(ref _serial); _logger.MinLogLevel = LogLevel.Trace; _logger.LogTrace("This is a trace"); @@ -174,9 +174,71 @@ _logger.LogTrace("This won't be displayed, only critical will be"); _logger.LogCritical("Critical message will be displayed"); ``` +### Create your own formatting + +You can use a custom formatter which will give you the name of the logger, the log level, the event ID, the message itself and a potential exception. The function definition should follow the following pattern: + +```csharp +public interface IMessageFormatter +{ + string MessageFormatter(string className, LogLevel logLevel, EventId eventId, string state, Exception exception); +} +``` + +**Important**: this function will be called directly, without instantiating the class it is part of. So make sure either this function is a static, either it's part of the class using the logger. The static option always works. The interface is given for convenience and to give the format. + +To setup the formatting, just use the following line. The type of the class containing the function and the exact name of the function are required. + +```csharp +LoggerExtensions.MessageFormatter = typeof(MyFormatter).GetType().GetMethod("MessageFormatterStatic"); + +public class MyFormatter +{ + public string MessageFormatterStatic(string className, LogLevel logLevel, EventId eventId, string state, Exception exception) + { + string logstr = string.Empty; + switch (logLevel) + { + case LogLevel.Trace: + logstr = "TRACE: "; + break; + case LogLevel.Debug: + logstr = "I love debug: "; + break; + case LogLevel.Warning: + logstr = "WARNING: "; + break; + case LogLevel.Error: + logstr = "ERROR: "; + break; + case LogLevel.Critical: + logstr = "CRITICAL:"; + break; + case LogLevel.None: + case LogLevel.Information: + default: + break; + } + + string eventstr = eventId.Id != 0 ? $" Event ID: {eventId}, " : string.Empty; + string msg = $"[{className}] {eventstr}{logstr} {state}"; + if (exception != null) + { + msg += $" {exception}"; + } + + return msg; + } +} +``` + +You are free to use anything you'd like and format as you like the message. + +Note: It is **not** necessary to add a \r\n at the end, this is done by each logger. + ## Code of Conduct -This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. +This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behaviour in our community. For more information see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct). ### .NET Foundation diff --git a/Tests/UnitTestDebugLogging/FormattingTest.cs b/Tests/UnitTestDebugLogging/FormattingTest.cs new file mode 100644 index 0000000..f845f82 --- /dev/null +++ b/Tests/UnitTestDebugLogging/FormattingTest.cs @@ -0,0 +1,114 @@ +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; +using nanoFramework.Logging; +using Microsoft.Extensions.Logging; +using nanoFramework.Logging.Debug; + +namespace UnitTestDebugLogging +{ + [TestClass] + class FormattingTest + { + static DebugLogger _logger; + + [Setup] + public void SteupFormattingTest() + { + _logger = new DebugLogger(nameof(FormattingTest)); + LoggerExtensions.MessageFormatter = typeof(MyFormatter).GetType().GetMethod("MessageFormatterStatic"); + Debug.WriteLine($"{LoggerExtensions.MessageFormatter.Name}"); + _logger.MinLogLevel = LogLevel.Trace; + } + + [TestMethod] + public void TestInvoke() + { + string msg = (string)LoggerExtensions.MessageFormatter.Invoke(null, new object[] { "test", LogLevel.Trace, new EventId(0), "some text", null }); + Debug.WriteLine(msg); + } + + [TestMethod] + public void TestFormatting() + { + LogAll(); + } + + [TestMethod] + public void TestFormattingSimple() + { + LoggerExtensions.MessageFormatter = typeof(MyFormatter).GetType().GetMethod("MessageFormatterSimple"); + LogAll(); + } + + private void LogAll() + { + Debug.WriteLine($"Expexcted level: {_logger.MinLogLevel}"); + _logger.LogTrace("{0} {1}", new object[] { "param 1", 42 }); + _logger.LogDebug("{0} {1}", new object[] { "param 1", 42 }); + _logger.LogInformation("Just some information and nothing else"); + _logger.LogWarning("{0} {1}", new object[] { "param 1", 42 }); + _logger.LogError(new Exception("Big problem"), "{0} {1}", new object[] { "param 1", 42 }); + _logger.LogCritical(42, new Exception("Insane problem"), "{0} {1}", new object[] { "param 1", 42 }); + } + + [Cleanup] + public void CleanupFormattingTest() + { + LoggerExtensions.MessageFormatter = null; + } + } + + public class MyFormatter : IMessageFormatter + { + public string MessageFormatter(string className, LogLevel logLevel, EventId eventId, string state, Exception exception) + => MessageFormatterStatic(className, logLevel, eventId, state, exception); + + public string MessageFormatterStatic(string className, LogLevel logLevel, EventId eventId, string state, Exception exception) + { + string logstr = string.Empty; + switch (logLevel) + { + case LogLevel.Trace: + logstr = "TRACE: "; + break; + case LogLevel.Debug: + logstr = "I love debug: "; + break; + case LogLevel.Warning: + logstr = "WARNING: "; + break; + case LogLevel.Error: + logstr = "ERROR: "; + break; + case LogLevel.Critical: + logstr = "CRITICAL:"; + break; + case LogLevel.None: + case LogLevel.Information: + default: + break; + } + + string eventstr = eventId.Id != 0 ? $" Event ID: {eventId}, " : string.Empty; + string msg = $"[{className}] {eventstr}{logstr} {state}"; + if (exception != null) + { + msg += $" {exception}"; + } + + return msg; + } + + public string MessageFormatterSimple(string className, LogLevel logLevel, EventId eventId, string state, Exception exception) + { + string msg = $"[{className}] {logLevel}-{state}"; + if (exception != null) + { + msg += $" {exception}"; + } + + return msg; + } + } +} diff --git a/Tests/UnitTestDebugLogging/MemoryStreamTests.cs b/Tests/UnitTestDebugLogging/MemoryStreamTests.cs index bac5d4a..7e12d29 100644 --- a/Tests/UnitTestDebugLogging/MemoryStreamTests.cs +++ b/Tests/UnitTestDebugLogging/MemoryStreamTests.cs @@ -27,7 +27,7 @@ public void TestStreamFile() memoryStream.Read(fsContent, 0, fsContent.Length); var fsText = Encoding.UTF8.GetString(fsContent, 0, fsContent.Length); Assert.StartsWith("An informative message", fsText); - Assert.EndsWith("With exception context System.Exception: Something is not supported", fsText); + Assert.EndsWith("With exception context System.Exception: Something is not supported\r\n", fsText); } [Cleanup] diff --git a/Tests/UnitTestDebugLogging/MyTestComponent.cs b/Tests/UnitTestDebugLogging/MyTestComponent.cs index 408edd7..efa9c2c 100644 --- a/Tests/UnitTestDebugLogging/MyTestComponent.cs +++ b/Tests/UnitTestDebugLogging/MyTestComponent.cs @@ -11,7 +11,7 @@ namespace UnitTestDebugLogging { internal class MyTestComponent { - private ILogger _logger; + private readonly ILogger _logger; public MyTestComponent() { diff --git a/Tests/UnitTestDebugLogging/SerialTest.cs b/Tests/UnitTestDebugLogging/SerialTest.cs index 090a861..5a2cd13 100644 --- a/Tests/UnitTestDebugLogging/SerialTest.cs +++ b/Tests/UnitTestDebugLogging/SerialTest.cs @@ -7,7 +7,7 @@ using nanoFramework.Logging.Serial; using nanoFramework.TestFramework; using System; -using Windows.Devices.SerialCommunication; +using System.IO.Ports; #if BUIID_FOR_ESP32 using nanoFramework.Hardware.Esp32; #endif @@ -17,33 +17,31 @@ namespace UnitTestDebugLogging [TestClass] class SerialTest { - static object myObject = new object(); - [Setup] public void SetupSerialHardware() { + // Remove this line to run hardware tests + Assert.SkipTest("No serial hardware test"); try { #if BUIID_FOR_ESP32 - //////////////////////////////////////////////////////////////////////////////////////////////////// - // COM2 in ESP32-WROVER-KIT mapped to free GPIO pins - // mind to NOT USE pins shared with other devices, like serial flash and PSRAM - // also it's MANDATORY to set pin funcion to the appropriate COM before instanciating it + //////////////////////////////////////////////////////////////////////////////////////////////////// + // COM2 in ESP32-WROVER-KIT mapped to free GPIO pins + // mind to NOT USE pins shared with other devices, like serial flash and PSRAM + // also it's MANDATORY to set pin funcion to the appropriate COM before instanciating it - // set GPIO functions for COM2 (this is UART1 on ESP32) - Configuration.SetPinFunction(Gpio.IO04, DeviceFunction.COM2_TX); - Configuration.SetPinFunction(Gpio.IO05, DeviceFunction.COM2_RX); + // set GPIO functions for COM2 (this is UART1 on ESP32) + Configuration.SetPinFunction(Gpio.IO04, DeviceFunction.COM2_TX); + Configuration.SetPinFunction(Gpio.IO05, DeviceFunction.COM2_RX); - // open COM2 - LogDispatcher.LoggerFactory = new SerialLoggerFactory("COM2"); + // open COM2 + LogDispatcher.LoggerFactory = new SerialLoggerFactory("COM2"); #else /////////////////////////////////////////////////////////////////////////////////////////////////// // COM6 in STM32F769IDiscovery board (Tx, Rx pins exposed in Arduino header CN13: TX->D1, RX->D0) // open COM6 LogDispatcher.LoggerFactory = new SerialLoggerFactory("COM6"); #endif - // Try to get the logger to see if all is ok or not - var logger = myObject.GetCurrentClassLogger(); } catch (Exception ex) { diff --git a/Tests/UnitTestDebugLogging/UnitTestDebugLogging.nfproj b/Tests/UnitTestDebugLogging/UnitTestDebugLogging.nfproj index 3c55b98..1e232d3 100644 --- a/Tests/UnitTestDebugLogging/UnitTestDebugLogging.nfproj +++ b/Tests/UnitTestDebugLogging/UnitTestDebugLogging.nfproj @@ -1,7 +1,7 @@ - $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + $(MSBuildExtensionsPath)\nanoFramework\v1.0\ @@ -29,6 +29,7 @@ + @@ -38,54 +39,44 @@ - - ..\..\Logging\packages\nanoFramework.CoreLibrary.1.10.3-preview.7\lib\mscorlib.dll + + ..\..\packages\nanoFramework.CoreLibrary.1.11.7\lib\mscorlib.dll True - True - - ..\..\Logging\packages\nanoFramework.Hardware.Esp32.1.3.3-preview.3\lib\nanoFramework.Hardware.Esp32.dll + + ..\..\packages\nanoFramework.Hardware.Esp32.1.3.4\lib\nanoFramework.Hardware.Esp32.dll True - True - - ..\..\Logging\packages\nanoFramework.Runtime.Events.1.9.0-preview.16\lib\nanoFramework.Runtime.Events.dll + + ..\..\packages\nanoFramework.Runtime.Events.1.9.2\lib\nanoFramework.Runtime.Events.dll True - True - - ..\..\Logging\packages\nanoFramework.System.Text.1.1.1-preview.35\lib\nanoFramework.System.Text.dll + + ..\..\packages\nanoFramework.System.Collections.1.3.0\lib\nanoFramework.System.Collections.dll True - True - - ..\..\Logging\packages\nanoFramework.TestFramework.1.0.101\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.System.Text.1.1.2\lib\nanoFramework.System.Text.dll True - True - - ..\..\Logging\packages\nanoFramework.TestFramework.1.0.101\lib\nanoFramework.UnitTestLauncher.exe + + ..\..\packages\nanoFramework.TestFramework.1.0.166\lib\nanoFramework.TestFramework.dll True - True - - ..\..\Logging\packages\nanoFramework.System.IO.FileSystem.1.0.0-preview.30\lib\System.IO.FileSystem.dll + + ..\..\packages\nanoFramework.TestFramework.1.0.166\lib\nanoFramework.UnitTestLauncher.exe True - True - - ..\..\Logging\packages\nanoFramework.Windows.Devices.SerialCommunication.1.3.4-preview.55\lib\Windows.Devices.SerialCommunication.dll + + ..\..\packages\nanoFramework.System.IO.FileSystem.1.0.2\lib\System.IO.FileSystem.dll True - True - - ..\..\Logging\packages\nanoFramework.Windows.Storage.Streams.1.10.1-preview.28\lib\Windows.Storage.Streams.dll + + ..\..\packages\nanoFramework.System.IO.Ports.1.0.2\lib\System.IO.Ports.dll True - True - @@ -96,16 +87,16 @@ - + - Update the Import path in nfproj to the correct nanoFramework.TestFramework NuGet package folder. + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. - + \ No newline at end of file diff --git a/Tests/UnitTestDebugLogging/app.config b/Tests/UnitTestDebugLogging/app.config deleted file mode 100644 index ee82bfd..0000000 --- a/Tests/UnitTestDebugLogging/app.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Tests/UnitTestDebugLogging/packages.config b/Tests/UnitTestDebugLogging/packages.config index 32b510a..8bb5b7c 100644 --- a/Tests/UnitTestDebugLogging/packages.config +++ b/Tests/UnitTestDebugLogging/packages.config @@ -1,11 +1,11 @@  - - - - - - - - + + + + + + + + \ No newline at end of file diff --git a/assets/nf-logo.png b/assets/nf-logo.png index 6f576ca..572c4ff 100644 Binary files a/assets/nf-logo.png and b/assets/nf-logo.png differ diff --git a/assets/readme.txt b/assets/readme.txt index fae61c7..f729981 100644 --- a/assets/readme.txt +++ b/assets/readme.txt @@ -6,7 +6,7 @@ =================================================================================== -API docs: https://docs.nanoframework.net/api +API docs: https://docs.nanoframework.net/api/nanoFramework.Logging Browse our samples repository: https://github.com/nanoframework/samples diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 636348a..2e98243 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,12 +1,14 @@ trigger: branches: - include: [master, develop, "release-*" ] + include: [main, develop, "release-*" ] paths: - exclude: ["*.md", .gitignore] + exclude: [README.md, LICENSE.md, NuGet.Config, .github_changelog_generator, .gitignore] tags: include: ["v*"] # PR always trigger build +pr: + autoCancel: true # add nf-tools repo to resources (for Azure Pipelines templates) resources: @@ -17,15 +19,14 @@ resources: endpoint: nanoframework pool: - vmImage: 'VS2017-Win2016' + vmImage: 'windows-2019' variables: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - solution: '**/*.sln' + DOTNET_NOLOGO: true + solution: 'nanoFramework.Logging.sln' buildPlatform: 'Any CPU' buildConfiguration: 'Release' nugetPackageName: 'nanoFramework.Logging' - repoName: 'nanoFramework.Logging' steps: @@ -34,6 +35,8 @@ steps: - template: azure-pipelines-templates/class-lib-build-only.yml@templates parameters: sonarCloudProject: 'nanoframework_nanoFramework.Logging' + runUnitTests: true + unitTestRunsettings: '$(System.DefaultWorkingDirectory)\Tests\UnitTestDebugLogging\nano.runsettings' # package steps - template: azure-pipelines-templates/class-lib-package.yml@templates @@ -52,100 +55,64 @@ steps: # need to push remaining packages to NuGet individually because the template above can only push one package (happens on tag builds for any branch) - task: NuGetCommand@2 - inputs: - command: push - nuGetFeedType: external - allowPackageConflicts: true - packagesToPush: - $(Build.ArtifactStagingDirectory)/nanoFramework.Logging.Serial.$(MY_NUGET_VERSION).nupkg - $(Build.ArtifactStagingDirectory)/nanoFramework.Logging.Serial.$(MY_NUGET_VERSION).snupkg - publishFeedCredentials: 'AzureArtifacts-$(System.TeamProject)' - includeSymbols: true condition: and( succeeded(), ne( variables['StartReleaseCandidate'], true ) ) continueOnError: true - displayName: Push "Serial" variant NuGet package to Azure Artifacts - -- task: NuGetCommand@2 + displayName: Push NuGet package to Azure Artifacts inputs: command: push nuGetFeedType: external allowPackageConflicts: true packagesToPush: - $(Build.ArtifactStagingDirectory)/nanoFramework.Logging.Stream.$(MY_NUGET_VERSION).nupkg - $(Build.ArtifactStagingDirectory)/nanoFramework.Logging.Stream.$(MY_NUGET_VERSION).snupkg + $(Build.ArtifactStagingDirectory)/*.nupkg + $(Build.ArtifactStagingDirectory)/*.snupkg publishFeedCredentials: 'AzureArtifacts-$(System.TeamProject)' includeSymbols: true - condition: and( succeeded(), ne( variables['StartReleaseCandidate'], true ) ) - continueOnError: true - displayName: Push "Stream" variant NuGet package to Azure Artifacts - task: NuGetCommand@2 - inputs: - command: push - nuGetFeedType: external - allowPackageConflicts: true - packagesToPush: - $(Build.ArtifactStagingDirectory)/nanoFramework.Logging.Serial.$(MY_NUGET_VERSION).nupkg - $(Build.ArtifactStagingDirectory)/nanoFramework.Logging.Serial.$(MY_NUGET_VERSION).snupkg - publishFeedCredentials: 'NuGet-$(System.TeamProject)' - includeSymbols: true - condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), ne( variables['StartReleaseCandidate'], true ) ) + condition: and( succeeded(), ne( variables['StartReleaseCandidate'], true ) ) continueOnError: true - displayName: Push "Serial" variant NuGet package to NuGet - -- task: NuGetCommand@2 + displayName: Push NuGet packages to Nuget inputs: command: push nuGetFeedType: external allowPackageConflicts: true packagesToPush: - $(Build.ArtifactStagingDirectory)/nanoFramework.Logging.Stream.$(MY_NUGET_VERSION).nupkg - $(Build.ArtifactStagingDirectory)/nanoFramework.Logging.Stream.$(MY_NUGET_VERSION).snupkg + $(Build.ArtifactStagingDirectory)/*.nupkg + $(Build.ArtifactStagingDirectory)/*.snupkg publishFeedCredentials: 'NuGet-$(System.TeamProject)' includeSymbols: true - condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), ne( variables['StartReleaseCandidate'], true ) ) - continueOnError: true - displayName: Push "Stream" variant NuGet package to NuGet # create or update GitHub release -- task: GitHubReleasePublish@1 +- task: GithubRelease@1 + condition: and( succeeded(), eq(variables['System.PullRequest.PullRequestId'], ''), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), ne( variables['StartReleaseCandidate'], true ) ) + displayName: Create/Update GitHub PREVIEW release inputs: - githubEndpoint: 'nanoframework' - githubOwner: 'nanoframework' - githubRepositoryName: $(repoName) - githubTag: v$(MY_NUGET_VERSION) - githubReleaseTitle: '$(nugetPackageName) Library v$(MY_NUGET_VERSION)' - githubReleaseNotes: 'Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG.md).

Install from NuGet


The following NuGet packages are available for download from this release:
:package: [.NET](https://www.nuget.org/packages/$(nugetPackageName)/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION).
:package: [.NET (Serial API only)](https://www.nuget.org/packages/nanoFramework.Logging.Serial/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)
:package: [.NET (server API only)](https://www.nuget.org/packages/nanoFramework.Logging.Server/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)' - githubTargetCommitsh: $(Build.SourceVersion) - githubReleaseDraft: false - githubReleasePrerelease: true - githubReuseDraftOnly: false - githubReuseRelease: true - githubEditRelease: true - githubDeleteEmptyTag: true - githubReleaseAsset: '$(Build.ArtifactStagingDirectory)/*.nupkg' - condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), not( startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), ne( variables['StartReleaseCandidate'], true ) ) - displayName: Create/Update GitHub PREVIEW release - -# create or update GitHub release ON tags from release or master branches -- task: GitHubReleasePublish@1 - inputs: - githubEndpoint: 'nanoframework' - githubOwner: 'nanoframework' - githubRepositoryName: $(repoName) - githubTag: v$(MY_NUGET_VERSION) - githubReleaseTitle: '$(nugetPackageName) Library v$(MY_NUGET_VERSION)' - githubReleaseNotes: 'Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG.md).

Install from NuGet


The following NuGet packages are available for download from this release:
:package: [.NET](https://www.nuget.org/packages/$(nugetPackageName)/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION).
:package: [.NET (Stream API only)](https://www.nuget.org/packages/nanoFramework.Logging.Stream/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)
:package: [.NET (server API only)](https://www.nuget.org/packages/nanoFramework.Logging.Server/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)' - githubTargetCommitsh: $(Build.SourceVersion) - githubReleaseDraft: false - githubReleasePrerelease: false - githubReuseDraftOnly: false - githubReuseRelease: true - githubEditRelease: true - githubDeleteEmptyTag: true - githubReleaseAsset: '$(Build.ArtifactStagingDirectory)/*.nupkg' + gitHubConnection: 'github.com_nano-$(System.TeamProject)' + tagSource: userSpecifiedTag + tag: v$(MY_NUGET_VERSION) + title: '$(nugetPackageName) Library v$(MY_NUGET_VERSION)' + releaseNotesSource: inline + releaseNotesInline: 'Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG.md).

Install from NuGet


The following NuGet packages are available for download from this release:
:package: [.NET](https://www.nuget.org/packages/$(nugetPackageName)/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION).
:package: [.NET (Serial API only)](https://www.nuget.org/packages/nanoFramework.Logging.Serial/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)
:package: [.NET (Serial API only)](https://www.nuget.org/packages/nanoFramework.Logging.Serial/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)' + assets: '$(Build.ArtifactStagingDirectory)/$(nugetPackageName).$(MY_NUGET_VERSION).nupkg' + assetUploadMode: replace + isPreRelease: true + addChangeLog: false + +# create or update GitHub release ON tags from release or main branches +- task: GithubRelease@1 condition: and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), not(contains(variables['Build.SourceBranch'], 'preview') ), ne( variables['StartReleaseCandidate'], true ) ) displayName: Create/Update GitHub stable release + inputs: + gitHubConnection: 'github.com_nano-$(System.TeamProject)' + tagSource: userSpecifiedTag + tag: v$(MY_NUGET_VERSION) + title: '$(nugetPackageName) Library v$(MY_NUGET_VERSION)' + releaseNotesSource: inline + releaseNotesInline: 'Check the [changelog]($(Build.Repository.Uri)/blob/$(Build.SourceBranchName)/CHANGELOG.md).

Install from NuGet


The following NuGet packages are available for download from this release:
:package: [.NET](https://www.nuget.org/packages/$(nugetPackageName)/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION).
:package: [.NET (Stream API only)](https://www.nuget.org/packages/nanoFramework.Logging.Stream/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)
:package: [.NET (Serial API only)](https://www.nuget.org/packages/nanoFramework.Logging.Serial/$(MY_NUGET_VERSION)) v$(MY_NUGET_VERSION)' + assets: '$(Build.ArtifactStagingDirectory)/$(nugetPackageName).$(MY_NUGET_VERSION).nupkg' + assetUploadMode: replace + isPreRelease: false + addChangeLog: false # step from template @ nf-tools repo # report error diff --git a/config/SignClient.json b/config/SignClient.json new file mode 100644 index 0000000..482177d --- /dev/null +++ b/config/SignClient.json @@ -0,0 +1,14 @@ +{ + "SignClient": { + "AzureAd": { + "AADInstance": "https://login.microsoftonline.com/", + "ClientId": "c248d68a-ba6f-4aa9-8a68-71fe872063f8", + "TenantId": "16076fdc-fcc1-4a15-b1ca-32c9a255900e" + }, + "Service": { + "Url": "https://codesign.dotnetfoundation.org/", + "ResourceId": "https://SignService/3c30251f-36f3-490b-a955-520addb85001" + } + } + } + \ No newline at end of file diff --git a/config/filelist.txt b/config/filelist.txt new file mode 100644 index 0000000..011125d --- /dev/null +++ b/config/filelist.txt @@ -0,0 +1 @@ +**/nanoFramework.Logging.* \ No newline at end of file diff --git a/nanoFramework.Logging.Serial.nuspec b/nanoFramework.Logging.Serial.nuspec index ba5dedf..c696327 100644 --- a/nanoFramework.Logging.Serial.nuspec +++ b/nanoFramework.Logging.Serial.nuspec @@ -5,29 +5,26 @@ $version$ nanoFramework.Logging.Serial nanoFramework project contributors - nanoFramework project contributors + nanoFramework,dotnetfoundation false - Apache-2.0 + LICENSE.md + docs\README.md false - https://github.com/nanoframework/lib-nanoFramework.nanoFramework.Logging.Serial - https://secure.gravatar.com/avatar/97d0e092247f0716db6d4b47b7d1d1ad - + https://github.com/nanoframework/nanoFramework.Logging + images\nf-logo.png + Copyright (c) .NET Foundation and Contributors - - This package includes the nanoFramework.Logging.Serial assembly (Serial Logging only) for nanoFramework C# projects. - . -There is also a package with the Stream Logging only and another with the basic Debug Logging. - - nanoFramework.Logging.Serial assembly (Serial Logging only) for nanoFramework C# projects + This package includes the nanoFramework.Logging.Serial assembly (Serial Logging only) for .NET nanoFramework C# projects. +There is also a package with the Stream Logging only and another with the basic Debug Logging. nanoFramework C# csharp netmf netnf nanoFramework.Logging.Serial - - - - - + + + + + @@ -36,7 +33,9 @@ There is also a package with the Stream Logging only and another with the basic - - + + + + \ No newline at end of file diff --git a/nanoFramework.Logging.Serial/Properties/AssemblyInfo.cs b/nanoFramework.Logging.Serial/Properties/AssemblyInfo.cs index 61f731f..387680d 100644 --- a/nanoFramework.Logging.Serial/Properties/AssemblyInfo.cs +++ b/nanoFramework.Logging.Serial/Properties/AssemblyInfo.cs @@ -5,33 +5,16 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("CSharp.BlankApplication")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("CSharp.BlankApplication")] -[assembly: AssemblyCopyright("Copyright © ")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] +[assembly: AssemblyTitle("nanoFramework.Logging")] +[assembly: AssemblyCompany("nanoFramework Contributors")] +[assembly: AssemblyProduct("nanoFramework.Logging")] +[assembly: AssemblyCopyright("Copyright (c) .NET Foundation and Contributors")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] - ///////////////////////////////////////////////////////////////// // This attribute is mandatory when building Interop libraries // // update this whenever the native assembly signature changes // diff --git a/nanoFramework.Logging.Serial/SerialLogger.cs b/nanoFramework.Logging.Serial/SerialLogger.cs index 6ad0911..36a4cca 100644 --- a/nanoFramework.Logging.Serial/SerialLogger.cs +++ b/nanoFramework.Logging.Serial/SerialLogger.cs @@ -3,35 +3,47 @@ // See LICENSE file in the project root for full license information. // -using System; using Microsoft.Extensions.Logging; -using Windows.Devices.SerialCommunication; -using Windows.Storage.Streams; +using System; +using System.IO; +using System.IO.Ports; +using System.Reflection; namespace nanoFramework.Logging.Serial { /// - /// A logger that prints to the debug console + /// A logger that outputs to a . /// public class SerialLogger : ILogger { - private readonly DataWriter _outputDataWriter; + private readonly SerialPort _serialPort; /// - /// Creates a new instance of the + /// Creates a new instance of the /// /// The serial port to use - public SerialLogger(ref SerialDevice serialDevice) + /// The logger name + public SerialLogger(ref SerialPort serialDevice, string loggerName) { - SerialDevice = serialDevice; - _outputDataWriter = new DataWriter(serialDevice.OutputStream); + _serialPort = serialDevice; + if (!_serialPort.IsOpen) + { + _serialPort.Open(); + } + + LoggerName = loggerName; MinLogLevel = LogLevel.Debug; } + /// + /// Name of the logger + /// + public string LoggerName { get; } + /// /// Name of the serial device /// - public SerialDevice SerialDevice { get; } + public SerialPort SerialPort => _serialPort; /// /// Sets the minimum log level @@ -42,13 +54,21 @@ public SerialLogger(ref SerialDevice serialDevice) public bool IsEnabled(LogLevel logLevel) => logLevel >= MinLogLevel; /// - public void Log(LogLevel logLevel, EventId eventId, string state, Exception exception) + public void Log(LogLevel logLevel, EventId eventId, string state, Exception exception, MethodInfo format) { if (logLevel >= MinLogLevel) { - string msg = exception == null ? state : $"{state} {exception}"; - _outputDataWriter.WriteString(msg); - _outputDataWriter.Store(); + string msgSerial; + if (format == null) + { + msgSerial = exception == null ? $"{state}\r\n" : $"{state} {exception}\r\n"; + } + else + { + msgSerial = $"{(string)format.Invoke(null, new object[] { LoggerName, logLevel, eventId, state, exception })}\r\n"; + } + + _serialPort.Write(msgSerial); } } } diff --git a/nanoFramework.Logging.Serial/SerialLoggerFactory.cs b/nanoFramework.Logging.Serial/SerialLoggerFactory.cs index c3effb3..ec0ce15 100644 --- a/nanoFramework.Logging.Serial/SerialLoggerFactory.cs +++ b/nanoFramework.Logging.Serial/SerialLoggerFactory.cs @@ -4,7 +4,7 @@ // using Microsoft.Extensions.Logging; -using Windows.Devices.SerialCommunication; +using System.IO.Ports; namespace nanoFramework.Logging.Serial { @@ -13,15 +13,30 @@ namespace nanoFramework.Logging.Serial /// public class SerialLoggerFactory : ILoggerFactory { - private SerialDevice _serial; - private string _comPort; - private uint _baudRate; - private ushort _dataBits; - private SerialParity _parity; - private SerialStopBitCount _stopBits; - private SerialHandshake _handshake; + private SerialPort _serial; + private readonly string _comPort; + private readonly int _baudRate; + private readonly ushort _dataBits; + private readonly Parity _parity; + private readonly StopBits _stopBits; + private readonly Handshake _handshake; - public SerialLoggerFactory(string comPort, uint baudRate = 9600, ushort dataBits = 8, SerialParity parity = SerialParity.None, SerialStopBitCount stopBits = SerialStopBitCount.One, SerialHandshake handshake = SerialHandshake.None) + /// + /// Create a new instance of from a . + /// + /// + /// + /// + /// + /// + /// + public SerialLoggerFactory( + string comPort, + int baudRate = 9600, + ushort dataBits = 8, + Parity parity = Parity.None, + StopBits stopBits = StopBits.One, + Handshake handshake = Handshake.None) { _comPort = comPort; _baudRate = baudRate; @@ -34,13 +49,13 @@ public SerialLoggerFactory(string comPort, uint baudRate = 9600, ushort dataBits /// public ILogger CreateLogger(string categoryName) { - _serial = SerialDevice.FromId(_comPort); + _serial = new SerialPort(_comPort); _serial.BaudRate = _baudRate; _serial.Parity = _parity; _serial.StopBits = _stopBits; _serial.Handshake = _handshake; _serial.DataBits = _dataBits; - return new SerialLogger(ref _serial); + return new SerialLogger(ref _serial, categoryName); } /// diff --git a/nanoFramework.Logging.Serial/app.config b/nanoFramework.Logging.Serial/app.config deleted file mode 100644 index 9b6cb55..0000000 --- a/nanoFramework.Logging.Serial/app.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/nanoFramework.Logging.Serial/nanoFramework.Logging.Serial.nfproj b/nanoFramework.Logging.Serial/nanoFramework.Logging.Serial.nfproj index 9f3d4b7..62d8e2f 100644 --- a/nanoFramework.Logging.Serial/nanoFramework.Logging.Serial.nfproj +++ b/nanoFramework.Logging.Serial/nanoFramework.Logging.Serial.nfproj @@ -1,7 +1,7 @@ - $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + $(MSBuildExtensionsPath)\nanoFramework\v1.0\ @@ -15,6 +15,7 @@ nanoFramework.Logging.Serial nanoFramework.Logging.Serial v1.0 + bin\$(Configuration)\nanoFramework.Logging.Serial.xml @@ -23,34 +24,28 @@ - - ..\Logging\packages\nanoFramework.CoreLibrary.1.10.3-preview.7\lib\mscorlib.dll + + ..\packages\nanoFramework.CoreLibrary.1.11.7\lib\mscorlib.dll True - True - - ..\Logging\packages\nanoFramework.Runtime.Events.1.9.0-preview.16\lib\nanoFramework.Runtime.Events.dll + + ..\packages\nanoFramework.Runtime.Events.1.9.2\lib\nanoFramework.Runtime.Events.dll True - True - - ..\Logging\packages\nanoFramework.System.Text.1.1.1-preview.35\lib\nanoFramework.System.Text.dll + + ..\packages\nanoFramework.System.Collections.1.3.0\lib\nanoFramework.System.Collections.dll True - True - - ..\Logging\packages\nanoFramework.Windows.Devices.SerialCommunication.1.3.4-preview.55\lib\Windows.Devices.SerialCommunication.dll + + ..\packages\nanoFramework.System.Text.1.1.2\lib\nanoFramework.System.Text.dll True - True - - ..\Logging\packages\nanoFramework.Windows.Storage.Streams.1.10.1-preview.28\lib\Windows.Storage.Streams.dll + + ..\packages\nanoFramework.System.IO.Ports.1.0.2\lib\System.IO.Ports.dll True - True - @@ -62,4 +57,11 @@ + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. + + + \ No newline at end of file diff --git a/nanoFramework.Logging.Serial/packages.config b/nanoFramework.Logging.Serial/packages.config index a7b6cfe..d718eeb 100644 --- a/nanoFramework.Logging.Serial/packages.config +++ b/nanoFramework.Logging.Serial/packages.config @@ -1,8 +1,9 @@  - - - - - + + + + + + \ No newline at end of file diff --git a/nanoFramework.Logging.Stream.nuspec b/nanoFramework.Logging.Stream.nuspec index 1c2854e..02bb345 100644 --- a/nanoFramework.Logging.Stream.nuspec +++ b/nanoFramework.Logging.Stream.nuspec @@ -5,27 +5,25 @@ $version$ nanoFramework.Logging.Stream nanoFramework project contributors - nanoFramework project contributors + nanoFramework,dotnetfoundation false - Apache-2.0 + LICENSE.md + docs\README.md false - https://github.com/nanoframework/lib-nanoFramework.Logging.Stream - https://secure.gravatar.com/avatar/97d0e092247f0716db6d4b47b7d1d1ad - + https://github.com/nanoframework/nanoFramework.Logging + images\nf-logo.png + Copyright (c) .NET Foundation and Contributors - - This package includes the nanoFramework.Logging.Stream assembly (Stream Logging only) for nanoFramework C# projects. - . -There is also a package with the Serial Logger only and another with the basic Debug Logger. - - nanoFramework.Logging.Stream assembly (Stream Logger only) for nanoFramework C# projects - nanoFramework C# csharp netmf netnf nanoFramework.Logging.Stream + This package includes the nanoFramework.Logging.Stream assembly (Stream Logging only) for .NET nanoFramework C# projects. +There is also a package with the Serial Logger only and another with the basic Debug Logger. + nanoFramework C# csharp netmf netnf logging - - - + + + + @@ -34,7 +32,9 @@ There is also a package with the Serial Logger only and another with the basic D - - + + + + \ No newline at end of file diff --git a/nanoFramework.Logging.Stream/Properties/AssemblyInfo.cs b/nanoFramework.Logging.Stream/Properties/AssemblyInfo.cs index 61f731f..387680d 100644 --- a/nanoFramework.Logging.Stream/Properties/AssemblyInfo.cs +++ b/nanoFramework.Logging.Stream/Properties/AssemblyInfo.cs @@ -5,33 +5,16 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("CSharp.BlankApplication")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("CSharp.BlankApplication")] -[assembly: AssemblyCopyright("Copyright © ")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] +[assembly: AssemblyTitle("nanoFramework.Logging")] +[assembly: AssemblyCompany("nanoFramework Contributors")] +[assembly: AssemblyProduct("nanoFramework.Logging")] +[assembly: AssemblyCopyright("Copyright (c) .NET Foundation and Contributors")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] - ///////////////////////////////////////////////////////////////// // This attribute is mandatory when building Interop libraries // // update this whenever the native assembly signature changes // diff --git a/nanoFramework.Logging.Stream/StreamLogger.cs b/nanoFramework.Logging.Stream/StreamLogger.cs index 44163c1..c6eb24a 100644 --- a/nanoFramework.Logging.Stream/StreamLogger.cs +++ b/nanoFramework.Logging.Stream/StreamLogger.cs @@ -2,34 +2,43 @@ // Copyright (c) .NET Foundation and Contributors // See LICENSE file in the project root for full license information. // +using Microsoft.Extensions.Logging; using System; using System.IO; +using System.Reflection; using System.Text; -using Microsoft.Extensions.Logging; +using SysIOStream = System.IO.Stream; namespace nanoFramework.Logging.Stream { /// - /// A logger that prints to the debug console + /// A logger that outputs to a . /// - public class StreamLogger : ILogger, IDisposable + public class StreamLogger : ILogger { - private System.IO.Stream _stream = null; - + private readonly SysIOStream _stream = null; + /// - /// Creates a new instance of the + /// Creates a new instance of the /// - /// fileName - public StreamLogger(System.IO.Stream stream) + /// Stream to output the log to. + /// The logger name + public StreamLogger(SysIOStream stream, string loggerName) { _stream = stream; + LoggerName = loggerName; MinLogLevel = LogLevel.Debug; } /// /// Name of the logger /// - public System.IO.Stream BaseStream { get; } + public string LoggerName { get; } + + /// + /// Name of the logger + /// + public SysIOStream BaseStream { get; } /// /// Sets the minimum log level @@ -40,27 +49,24 @@ public StreamLogger(System.IO.Stream stream) public bool IsEnabled(LogLevel logLevel) => logLevel >= MinLogLevel; /// - public void Log(LogLevel logLevel, EventId eventId, string state, Exception exception) + public void Log(LogLevel logLevel, EventId eventId, string state, Exception exception, MethodInfo format) { if (logLevel >= MinLogLevel) { - string msg = exception == null ? state : $"{state} {exception}"; - byte[] sampleBuffer = Encoding.UTF8.GetBytes(msg); + string msgStream; + if (format == null) + { + msgStream = exception == null ? $"{state}\r\n" : $"{state} {exception}\r\n"; + } + else + { + msgStream = $"{(string)format.Invoke(null, new object[] { LoggerName, logLevel, eventId, state, exception })}\r\n"; + } + + byte[] sampleBuffer = Encoding.UTF8.GetBytes(msgStream); _stream.Seek(0, SeekOrigin.End); _stream.Write(sampleBuffer, 0, sampleBuffer.Length); } } - - /// - /// Dispose properly the stream - /// - public void Dispose() - { - if(_stream != null) - { - _stream.Dispose(); - _stream = null; - } - } } } diff --git a/nanoFramework.Logging.Stream/StreamLoggerFactory.cs b/nanoFramework.Logging.Stream/StreamLoggerFactory.cs index bad0c2c..5e49b39 100644 --- a/nanoFramework.Logging.Stream/StreamLoggerFactory.cs +++ b/nanoFramework.Logging.Stream/StreamLoggerFactory.cs @@ -4,6 +4,7 @@ // using Microsoft.Extensions.Logging; using System.IO; +using SysIOStream = System.IO.Stream; namespace nanoFramework.Logging.Stream { @@ -12,13 +13,13 @@ namespace nanoFramework.Logging.Stream /// public class StreamLoggerFactory : ILoggerFactory { - private System.IO.Stream _stream; + private readonly SysIOStream _stream; /// - /// Create a new instance of Stream Logger Factory from a stream + /// Create a new instance of from a . /// /// The stream - public StreamLoggerFactory(System.IO.Stream stream) + public StreamLoggerFactory(SysIOStream stream) { _stream = stream; } @@ -40,7 +41,7 @@ public ILogger CreateLogger(string categoryName) throw new IOException(); } - return new StreamLogger(_stream); + return new StreamLogger(_stream, categoryName); } /// diff --git a/nanoFramework.Logging.Stream/app.config b/nanoFramework.Logging.Stream/app.config deleted file mode 100644 index 9b6cb55..0000000 --- a/nanoFramework.Logging.Stream/app.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/nanoFramework.Logging.Stream/nanoFramework.Logging.Stream.nfproj b/nanoFramework.Logging.Stream/nanoFramework.Logging.Stream.nfproj index 0818a44..313cefd 100644 --- a/nanoFramework.Logging.Stream/nanoFramework.Logging.Stream.nfproj +++ b/nanoFramework.Logging.Stream/nanoFramework.Logging.Stream.nfproj @@ -1,7 +1,7 @@ - $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + $(MSBuildExtensionsPath)\nanoFramework\v1.0\ @@ -15,6 +15,7 @@ nanoFramework.Logging.Stream nanoFramework.Logging.Stream v1.0 + bin\$(Configuration)\nanoFramework.Logging.Stream.xml @@ -23,24 +24,24 @@ - - ..\Logging\packages\nanoFramework.CoreLibrary.1.10.3-preview.7\lib\mscorlib.dll + + ..\packages\nanoFramework.CoreLibrary.1.11.7\lib\mscorlib.dll True - True - - ..\Logging\packages\nanoFramework.System.Text.1.1.1-preview.35\lib\nanoFramework.System.Text.dll + + ..\packages\nanoFramework.Runtime.Events.1.9.2\lib\nanoFramework.Runtime.Events.dll True - True - - ..\Logging\packages\nanoFramework.System.IO.FileSystem.1.0.0-preview.30\lib\System.IO.FileSystem.dll + + ..\packages\nanoFramework.System.Text.1.1.2\lib\nanoFramework.System.Text.dll + True + + + ..\packages\nanoFramework.System.IO.FileSystem.1.0.2\lib\System.IO.FileSystem.dll True - True - @@ -52,4 +53,11 @@ + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. + + + \ No newline at end of file diff --git a/nanoFramework.Logging.Stream/packages.config b/nanoFramework.Logging.Stream/packages.config index d50f3a2..dfb8371 100644 --- a/nanoFramework.Logging.Stream/packages.config +++ b/nanoFramework.Logging.Stream/packages.config @@ -1,6 +1,8 @@  - - - + + + + + \ No newline at end of file diff --git a/nanoFramework.Logging.nuspec b/nanoFramework.Logging.nuspec index 577ea99..77e39d4 100644 --- a/nanoFramework.Logging.nuspec +++ b/nanoFramework.Logging.nuspec @@ -5,26 +5,23 @@ $version$ nanoFramework.Logging nanoFramework project contributors - nanoFramework project contributors + nanoFramework,dotnetfoundation false - Apache-2.0 + LICENSE.md + docs\README.md false https://github.com/nanoframework/nanoFramework.Logging - https://secure.gravatar.com/avatar/97d0e092247f0716db6d4b47b7d1d1ad + images\nf-logo.png Copyright (c) .NET Foundation and Contributors - - This package includes the nanoFramework.Logging assembly for nanoFramework C# projects. - . + This package includes the nanoFramework.Logging assembly for .NET nanoFramework C# projects. There are also two other packages with just the Serial Logging and just the Stream Logging. - These are meant to be used when you want to use those possibilities. - - nanoFramework.Logging assembly for nanoFramework C# projects +These are meant to be used when you want to use those possibilities. nanoFramework C# csharp netmf netnf nanoFramework.Logging - + @@ -33,7 +30,9 @@ There are also two other packages with just the Serial Logging and just the Stre - - + + + + \ No newline at end of file diff --git a/Logging.sln b/nanoFramework.Logging.sln similarity index 86% rename from Logging.sln rename to nanoFramework.Logging.sln index 61c80ed..18d7f1b 100644 --- a/Logging.sln +++ b/nanoFramework.Logging.sln @@ -1,17 +1,17 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.31105.61 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "nanoFramework.Logging", ".\nanoFramework.Logging\nanoFramework.Logging.nfproj", "{0A60F291-B35A-4BF1-BAB9-CD686AF2EED6}" +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "nanoFramework.Logging", "nanoFramework.Logging\nanoFramework.Logging.nfproj", "{0A60F291-B35A-4BF1-BAB9-CD686AF2EED6}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{D29DC1AA-A2C8-40BA-AAE9-32E9252E81AD}" EndProject -Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "UnitTestDebugLogging", ".\Tests\UnitTestDebugLogging\UnitTestDebugLogging.nfproj", "{E7EE659C-D98C-43EA-A71A-45758CBF22A4}" +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "UnitTestDebugLogging", "Tests\UnitTestDebugLogging\UnitTestDebugLogging.nfproj", "{E7EE659C-D98C-43EA-A71A-45758CBF22A4}" EndProject -Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "nanoFramework.Logging.Serial", ".\nanoFramework.Logging.Serial\nanoFramework.Logging.Serial.nfproj", "{6FC962E1-FF13-406D-A8A6-64BB4DE64B67}" +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "nanoFramework.Logging.Serial", "nanoFramework.Logging.Serial\nanoFramework.Logging.Serial.nfproj", "{6FC962E1-FF13-406D-A8A6-64BB4DE64B67}" EndProject -Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "nanoFramework.Logging.Stream", ".\nanoFramework.Logging.Stream\nanoFramework.Logging.Stream.nfproj", "{38F918AD-5A39-4172-B4B4-ECC2A3FA5B4E}" +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "nanoFramework.Logging.Stream", "nanoFramework.Logging.Stream\nanoFramework.Logging.Stream.nfproj", "{38F918AD-5A39-4172-B4B4-ECC2A3FA5B4E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/nanoFramework.Logging/DebugLogger.cs b/nanoFramework.Logging/DebugLogger.cs index cb18b82..697e1c9 100644 --- a/nanoFramework.Logging/DebugLogger.cs +++ b/nanoFramework.Logging/DebugLogger.cs @@ -3,8 +3,9 @@ // See LICENSE file in the project root for full license information. // -using System; using Microsoft.Extensions.Logging; +using System; +using System.Reflection; namespace nanoFramework.Logging.Debug { @@ -16,6 +17,7 @@ public class DebugLogger : ILogger /// /// Creates a new instance of the /// + /// The logger name public DebugLogger(string loggerName) { LoggerName = loggerName; @@ -36,12 +38,22 @@ public DebugLogger(string loggerName) public bool IsEnabled(LogLevel logLevel) => logLevel >= MinLogLevel; /// - public void Log(LogLevel logLevel, EventId eventId, string state, Exception exception) + public void Log(LogLevel logLevel, EventId eventId, string state, Exception exception, MethodInfo format) { if (logLevel >= MinLogLevel) { - string msg = exception == null ? state : $"{state} {exception}"; - System.Diagnostics.Debug.WriteLine(msg); + string msg; + if (format == null) + { + msg = exception == null ? state : $"{state} {exception}"; + } + else + { + msg = (string)format.Invoke(null, new object[] { LoggerName, logLevel, eventId, state, exception }); + } + + // need to use Console.WriteLine to have this working on both Debug and Release flavours + Console.WriteLine(msg); } } } diff --git a/nanoFramework.Logging/DebugLoggerFactory.cs b/nanoFramework.Logging/DebugLoggerFactory.cs index 586e50f..8755e34 100644 --- a/nanoFramework.Logging/DebugLoggerFactory.cs +++ b/nanoFramework.Logging/DebugLoggerFactory.cs @@ -21,6 +21,7 @@ public ILogger CreateLogger(string categoryName) /// public void Dispose() { + // nothing to do here } } } \ No newline at end of file diff --git a/nanoFramework.Logging/ILogger.cs b/nanoFramework.Logging/ILogger.cs index 1707fdc..0c1799e 100644 --- a/nanoFramework.Logging/ILogger.cs +++ b/nanoFramework.Logging/ILogger.cs @@ -4,6 +4,7 @@ // using System; +using System.Reflection; namespace Microsoft.Extensions.Logging { @@ -20,7 +21,8 @@ public interface ILogger /// Id of the event. /// The entry to be written. /// The exception related to this entry. - void Log(LogLevel logLevel, EventId eventId, string state, Exception exception); + /// + void Log(LogLevel logLevel, EventId eventId, string state, Exception exception, MethodInfo format); /// /// Checks if the given is enabled. diff --git a/nanoFramework.Logging/ILoggerFactory.cs b/nanoFramework.Logging/ILoggerFactory.cs index 0b167b9..64b2fb4 100644 --- a/nanoFramework.Logging/ILoggerFactory.cs +++ b/nanoFramework.Logging/ILoggerFactory.cs @@ -9,7 +9,7 @@ namespace Microsoft.Extensions.Logging { /// /// Represents a type used to configure the logging system and create instances of from - /// the registered s. + /// the registered s. /// public interface ILoggerFactory : IDisposable { diff --git a/nanoFramework.Logging/IMessageFormatter.cs b/nanoFramework.Logging/IMessageFormatter.cs new file mode 100644 index 0000000..f421610 --- /dev/null +++ b/nanoFramework.Logging/IMessageFormatter.cs @@ -0,0 +1,22 @@ +using Microsoft.Extensions.Logging; +using System; + +namespace nanoFramework.Logging +{ + /// + /// Provide the skeleton for a Message Formatter logger + /// + public interface IMessageFormatter + { + /// + /// The function to format the message + /// + /// The name of the logger + /// The log level + /// The event id + /// The message itself + /// The exception + /// A formatted string + string MessageFormatter(string className, LogLevel logLevel, EventId eventId, string state, Exception exception); + } +} diff --git a/nanoFramework.Logging/LogDispatcher.cs b/nanoFramework.Logging/LogDispatcher.cs index 49ec761..590b781 100644 --- a/nanoFramework.Logging/LogDispatcher.cs +++ b/nanoFramework.Logging/LogDispatcher.cs @@ -3,8 +3,9 @@ // See LICENSE file in the project root for full license information. // -using System; using Microsoft.Extensions.Logging; +using System; +using System.Reflection; namespace nanoFramework.Logging { @@ -54,8 +55,9 @@ public static ILogger GetCurrentClassLogger(this object currentClass) private class NullLogger : ILogger { - public void Log(LogLevel logLevel, EventId eventId, string state, Exception exception) + public void Log(LogLevel logLevel, EventId eventId, string state, Exception exception, MethodInfo format) { + // nothing to do here } public bool IsEnabled(LogLevel logLevel) diff --git a/nanoFramework.Logging/LoggerExtensions.cs b/nanoFramework.Logging/LoggerExtensions.cs index 8846410..86137a3 100644 --- a/nanoFramework.Logging/LoggerExtensions.cs +++ b/nanoFramework.Logging/LoggerExtensions.cs @@ -4,6 +4,7 @@ // using System; +using System.Reflection; namespace Microsoft.Extensions.Logging { @@ -12,17 +13,22 @@ namespace Microsoft.Extensions.Logging /// public static class LoggerExtensions { - #region Debug - /// - /// Formats and writes a debug log message. + /// Provide a way to have the message formated /// - /// The to write to. - /// The event id associated with the log. - /// The exception to log. - /// Format string of the log message in message template format. Example: "User {User} logged in from {Address}" - /// An object array that contains zero or more objects to format. - /// logger.LogDebug(0, exception, "Error while processing request from {Address}", address) + public static MethodInfo MessageFormatter { get; set; } + + #region Debug + + /// + /// Formats and writes a debug log message. + /// + /// The to write to. + /// The event id associated with the log. + /// The exception to log. + /// Format string of the log message in message template format. Example: "User {User} logged in from {Address}" + /// An object array that contains zero or more objects to format. + /// logger.LogDebug(0, exception, "Error while processing request from {Address}", address) public static void LogDebug(this ILogger logger, EventId eventId, Exception exception, string message, params object[] args) { logger.Log(LogLevel.Debug, eventId, exception, message, args); @@ -346,6 +352,10 @@ public static void LogCritical(this ILogger logger, string message, params objec logger.Log(LogLevel.Critical, message, args); } + #endregion + + #region Primitives + /// /// Formats and writes a log message at the specified log level. /// @@ -400,7 +410,7 @@ public static void Log(this ILogger logger, LogLevel logLevel, EventId eventId, throw new ArgumentNullException(nameof(logger)); } - logger.Log(logLevel, eventId, string.Format(message, args), exception); + logger.Log(logLevel, eventId, string.Format(message, args), exception, MessageFormatter); } #endregion diff --git a/nanoFramework.Logging/Properties/AssemblyInfo.cs b/nanoFramework.Logging/Properties/AssemblyInfo.cs index 61f731f..387680d 100644 --- a/nanoFramework.Logging/Properties/AssemblyInfo.cs +++ b/nanoFramework.Logging/Properties/AssemblyInfo.cs @@ -5,33 +5,16 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("CSharp.BlankApplication")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("CSharp.BlankApplication")] -[assembly: AssemblyCopyright("Copyright © ")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] +[assembly: AssemblyTitle("nanoFramework.Logging")] +[assembly: AssemblyCompany("nanoFramework Contributors")] +[assembly: AssemblyProduct("nanoFramework.Logging")] +[assembly: AssemblyCopyright("Copyright (c) .NET Foundation and Contributors")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] - ///////////////////////////////////////////////////////////////// // This attribute is mandatory when building Interop libraries // // update this whenever the native assembly signature changes // diff --git a/nanoFramework.Logging/nanoFramework.Logging.nfproj b/nanoFramework.Logging/nanoFramework.Logging.nfproj index 023910d..e9c4328 100644 --- a/nanoFramework.Logging/nanoFramework.Logging.nfproj +++ b/nanoFramework.Logging/nanoFramework.Logging.nfproj @@ -1,7 +1,7 @@ - $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + $(MSBuildExtensionsPath)\nanoFramework\v1.0\ @@ -13,8 +13,18 @@ Properties 512 Logging - Logging + nanoFramework.Logging v1.0 + bin\$(Configuration)\nanoFramework.Logging.xml + + + true + + + key.snk + + + false @@ -22,6 +32,7 @@ + @@ -29,14 +40,14 @@ - - packages\nanoFramework.CoreLibrary.1.10.3-preview.7\lib\mscorlib.dll - True - True - + + - + + ..\packages\nanoFramework.CoreLibrary.1.11.7\lib\mscorlib.dll + True + @@ -44,4 +55,11 @@ + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}. + + + \ No newline at end of file diff --git a/nanoFramework.Logging/packages.config b/nanoFramework.Logging/packages.config index 802c996..6301cf5 100644 --- a/nanoFramework.Logging/packages.config +++ b/nanoFramework.Logging/packages.config @@ -1,4 +1,5 @@  - + + \ No newline at end of file diff --git a/version.json b/version.json index 3901c05..9d90e37 100644 --- a/version.json +++ b/version.json @@ -1,25 +1,23 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.0.0-preview.{height}", + "version": "1.0.0", "assemblyVersion": { "precision": "revision" }, - "versionHeightOffset": 3, "semVer1NumericIdentifierPadding": 3, "nuGetPackageVersion": { "semVer": 2.0 }, "publicReleaseRefSpec": [ - "^refs/heads/master$", + "^refs/heads/main$", "^refs/heads/v\\d+(?:\\.\\d+)?$" ], "cloudBuild": { - "setAllVariables": true, - "buildNumber": null + "setAllVariables": true }, "release": { "branchName": "release-v{version}", - "firstUnstableTag": "preview", - "versionIncrement": "build" + "versionIncrement": "build", + "firstUnstableTag": "preview" } -} +} \ No newline at end of file