Spider.Serilog.Sink
1.0.6
dotnet add package Spider.Serilog.Sink --version 1.0.6
NuGet\Install-Package Spider.Serilog.Sink -Version 1.0.6
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Spider.Serilog.Sink" Version="1.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Spider.Serilog.Sink" Version="1.0.6" />
<PackageReference Include="Spider.Serilog.Sink" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Spider.Serilog.Sink --version 1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Spider.Serilog.Sink, 1.0.6"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Spider.Serilog.Sink@1.0.6
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Spider.Serilog.Sink&version=1.0.6
#tool nuget:?package=Spider.Serilog.Sink&version=1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
一、部署Spider
使用iis或者nginx或者其他web服务器部署Spider,确保它能够正常访问。
二、安装Serilog.Sinks.Spider
在你的项目中安装Serilog.Sinks.Spider包,可以通过NuGet Package Manager或者命令行安装:
方式一, 在代码中直接配置Serilog:
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Information() // 设置基础过滤阈值
.WriteTo.Console() // 在本地控制台打印
.WriteTo.Spider( // 注入到 Spider 注册中心
spiderUrl: "http://server:80",
serviceId: "server-1",
serviceName: "myapi"
)
.CreateLogger();
方式二,在appsettings.json中配置Serilog:
{
"Serilog": {
"Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.Spider" ],
"MinimumLevel": "Information",
"WriteTo": [
{ "Name": "Console" },
{
"Name": "Spider",
"Args": {
"spiderUrl": "http://local:5000",
"serviceId": "server-1",
"serviceName": "myapi"
}
}
]
}
}
此时你只需要在代码中调用
Log.Logger = new LoggerConfiguration()
.ReadFrom
.Configuration(builder.Configuration)
.CreateLogger();
就可以完成 Serilog 的配置了。无论是 Console 还是 Spider Sink 都会被正确加载并使用。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Microsoft.AspNetCore.SignalR.Client (>= 6.0.36)
- Serilog (>= 4.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.