Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

全新设计的日志系统 #10

Merged
merged 49 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
ecd8537
Upgrade repo to latest
walterlv Apr 27, 2024
58ef20d
Remove legacy design of Logger projects.
walterlv Apr 27, 2024
bf4ac68
Use microsoft extensions basic logger files.
walterlv Apr 27, 2024
8a743f3
Add sample projects.
walterlv Apr 27, 2024
15f5b53
Add unit test project.
walterlv Apr 27, 2024
661cef6
考虑到 Logger 会跟类名冲突,我们将命名空间改为使用 Logging(保持与 Microsoft 一致)
walterlv Apr 27, 2024
50519c2
添加基本的日志系统结构
walterlv Apr 28, 2024
1bc17c3
尽量避免 net8 的写法在其他框架写不出来的问题
walterlv May 7, 2024
8d23d25
合入一部分日志的实现
walterlv May 7, 2024
f925a91
合入更多日志实现
walterlv May 7, 2024
6c7bf09
添加源生成器
walterlv May 7, 2024
be58f06
将源生成器加入到包中
walterlv May 8, 2024
8ef5c98
加入 Program 中的日志分部类
walterlv May 8, 2024
86a1f3d
删除示例源生成器
walterlv May 8, 2024
21a5bc4
整理文件夹
walterlv May 8, 2024
159f2a6
要求必须是 partial 类才生成日志辅助
walterlv May 8, 2024
be159fe
加入分析器多语言
walterlv May 8, 2024
c5a691c
分析 Program 分部类
walterlv May 8, 2024
033a679
支持将 Program 改为分部类
walterlv May 8, 2024
9f20030
整理
walterlv May 8, 2024
391afa4
在目标项目生成内部的日志类
walterlv May 8, 2024
8689a11
整理示例依赖
walterlv May 8, 2024
d8aa6ac
生成 GlobalUsings
walterlv May 8, 2024
846bd91
再生成几个 Writers
walterlv May 9, 2024
473c15a
使用 .g.cs 命名将来需要被生成的类,这样分析器可以告诉开发者针对生成代码的转有分析:
walterlv May 9, 2024
09cb780
为所有生成的文件添加注释
walterlv May 9, 2024
2fac6ae
在库项目中使用日志
walterlv May 9, 2024
5dbf04d
添加日志桥
walterlv May 9, 2024
37599d3
临时不生成 Program 分部类
walterlv May 9, 2024
cb19717
生成日志桥的连接代码
walterlv May 9, 2024
8cd9abd
生成 globalusings 时区分库和应用
walterlv May 9, 2024
2cf5258
删除不需要的文件
walterlv May 9, 2024
cbba2e3
修复 globalUsings 错误
walterlv May 9, 2024
7927713
构建日志时,可使用桥连接器
walterlv May 10, 2024
f9f8dd3
统一日志构建时的命名
walterlv May 10, 2024
3865e99
调整构建成最终目标的 API
walterlv May 10, 2024
71432bc
示例对接多个项目
walterlv May 10, 2024
9ebdd81
修复误加的引用
walterlv May 10, 2024
a2713a1
为 Program 生成日志辅助方法(无需引用库的那种)
walterlv May 10, 2024
ac90f16
重新开放 Program 类的 partial 分析
walterlv May 10, 2024
e00d912
默认使用缓存日志记录器
walterlv May 10, 2024
0857775
删除不再使用的两个早期设计类
walterlv May 10, 2024
3f956ee
加上日志缓存配置
walterlv May 10, 2024
d34c5f3
优化日志,减少线程安全问题
walterlv May 10, 2024
c67b5c8
使用动态日期
walterlv May 13, 2024
3273299
确保 MemoryCacheLogger 可被编译通过
walterlv May 20, 2024
d23b650
加入 MSBuild API 以分别使用源引用和库引用
walterlv May 20, 2024
d5f0cfe
更新 dotnet 版本
walterlv May 21, 2024
9df7d9b
升级语言特性库以解决部分类不生成的问题
walterlv May 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 57 additions & 63 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,63 +1,57 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
# Auto detect text files and perform LF normalization
* text=false

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=text
*.csproj merge=text
*.vbproj merge=text
*.fsproj merge=text
*.dbproj merge=text

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain

# ignore file

*.mp3 -diff
*.wav -diff
*.enas -diff
*.png -diff
*.jpg -diff
*.psd -diff
*.gif -diff

# binary
*.avi binary
*.bmp binary
*.exr binary
*.ico binary
*.jpeg binary
*.jpg binary
*.png binary

*.a binary
*.so binary
*.dll binary
*.jar binary

*.pdf binary
*.pbxproj binary
*.vec binary
*.doc binary
*.dia binary

# CR/LF

*.bat text eol=crlf
*.sh text eol=lf
8 changes: 4 additions & 4 deletions .github/workflows/nuget-tag-publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: publish nuget

on:
on:
push:
tags:
- '*'
Expand All @@ -12,16 +12,16 @@ jobs:

steps:
- uses: actions/checkout@v1

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.300
dotnet-version: 8.0.300

- name: Install dotnet tool
run: dotnet tool install -g dotnetCampus.TagToVersion

- name: Set tag to version
- name: Set tag to version
run: dotnet TagToVersion -t ${{ github.ref }}

- name: Build with dotnet
Expand Down
87 changes: 75 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Ignore Visual Studio temporary files, build results, and
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore

# User-specific files
*.rsuser
Expand All @@ -13,19 +13,24 @@
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Mono auto generated files
mono_crash.*

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/

# Visual Studio 2015/2017 cache/options directory
.vs/
Expand All @@ -39,9 +44,10 @@ Generated\ Files/
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# NUNIT
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml

# Build Results of an ATL Project
[Dd]ebugPS/
Expand All @@ -56,6 +62,9 @@ project.lock.json
project.fragment.lock.json
artifacts/

# ASP.NET Scaffolding
ScaffoldingReadMe.txt

# StyleCop
StyleCopReport.xml

Expand All @@ -81,6 +90,7 @@ StyleCopReport.xml
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
Expand Down Expand Up @@ -122,9 +132,6 @@ _ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding add-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

Expand All @@ -135,6 +142,11 @@ _TeamCity*
.axoCover/*
!.axoCover/settings.json

# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info

# Visual Studio code coverage results
*.coverage
*.coveragexml
Expand Down Expand Up @@ -182,6 +194,12 @@ PublishScripts/

# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
Expand All @@ -202,6 +220,8 @@ BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload

# Visual Studio cache files
# files ending in .cache can be ignored
Expand Down Expand Up @@ -251,7 +271,9 @@ ServiceFabricBackup/
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- Backup*.rdl
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl

# Microsoft Fakes
FakesAssemblies/
Expand All @@ -272,6 +294,17 @@ node_modules/
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp

# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp

# Visual Studio 6 technical files
*.ncb
*.aps

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
Expand All @@ -287,10 +320,6 @@ paket-files/
# FAKE - F# Make
.fake/

# JetBrains Rider
.idea/
*.sln.iml

# CodeRush personal settings
.cr/personal

Expand Down Expand Up @@ -332,5 +361,39 @@ ASALocalRun/
# Local History for Visual Studio
.localhistory/

# Visual Studio History (VSHistory) files
.vshistory/

# BeatPulse healthcheck temp database
healthchecksdb
healthchecksdb

# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/

# Fody - auto-generated XML schema
FodyWeavers.xsd

# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/

# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp

# JetBrains Rider
.idea/
*.sln.iml
1 change: 0 additions & 1 deletion CHANGELOG.md

This file was deleted.

24 changes: 15 additions & 9 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
<Project>

<Import Project="build\Version.props" />

<!-- 框架和语言信息 -->
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<PackageOutputPath>$(MSBuildThisFileDirectory)bin\$(Configuration)</PackageOutputPath>
<Company>dotnet campus(.NET 职业技术学院)</Company>

<!-- 替换下面信息 -->
<ArtifactsPath>$(MSBuildThisFileDirectory)artifacts</ArtifactsPath>
<RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
</PropertyGroup>

<!--库信息 -->
<PropertyGroup>
<Description>提供统一的日志记录方法。使用源生成器允许库的作者在不依赖本日志库的情况下完成日志的记录,并且还能对接到产品中完成日志的统一输出。</Description>
<Authors>dotnet-campus</Authors>
<Company>dotnet campus(.NET 职业技术学院)</Company>
<Copyright>Copyright 2020-$([System.DateTime]::Now.ToString(`yyyy`)) &#169; dotnet campus, All Rights Reserved.</Copyright>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/dotnet-campus/dotnetCampus.Logger</RepositoryUrl>
<PackageProjectUrl>https://github.com/dotnet-campus/dotnetCampus.Logger</PackageProjectUrl>
<Description>提供统一的日志记录方法,并附带各种各样的实现。</Description>

<RepositoryType>git</RepositoryType>
<Copyright>Copyright © 2020 dotnet campus, All Rights Reserved.</Copyright>
</PropertyGroup>
</Project>

</Project>
4 changes: 2 additions & 2 deletions build/Version.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>0.1.0-alpha</Version>
<Version>0.1.0-alpha01</Version>
</PropertyGroup>
</Project>
</Project>
Loading