Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/headless-knight/serilog.sinks.wecom
一个用于向企业微信机器人发送消息的Serilog日志插槽
https://github.com/headless-knight/serilog.sinks.wecom
csharp dotnet event logging serilog webhook wecom
Last synced: 9 days ago
JSON representation
一个用于向企业微信机器人发送消息的Serilog日志插槽
- Host: GitHub
- URL: https://github.com/headless-knight/serilog.sinks.wecom
- Owner: headless-knight
- License: mit
- Created: 2024-10-24T06:53:19.000Z (14 days ago)
- Default Branch: main
- Last Pushed: 2024-10-24T16:51:04.000Z (14 days ago)
- Last Synced: 2024-10-25T08:36:54.312Z (13 days ago)
- Topics: csharp, dotnet, event, logging, serilog, webhook, wecom
- Language: C#
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Serilog.Sinks.WeCom
一个用于向企业微信机器人发送消息的Serilog日志插槽
## 快速上手
### 添加NuGet包
```shell
dotnet add package Serilog.Sinks.WeCom
```### 使用方式
```csharp
// 配置Serilog
Log.Logger = new LoggerConfiguration()
.WriteTo.WeCom("https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=example")
.CreateLogger();
// 发送日志
Log.Error("Test message");
```接下来,您就可以在企业微信中查看机器人发送的日志了
### 配置参数
详细可配置参数如下:
| 参数 | 类型 | 描述 | 是否必须 | 默认值 |
|:--------------------------:|:--------------------------:|:----------------------:|:----:|:------------------------------------------:|
| Webhook | string | 企业微信机器人地址 | 是 | |
| MinimumLevel | LogEventLevel | 最低发送日志等级 | | Information |
| Title | string | 标题,随日志一起发送 | | This message send by Serilog\.Sinks\.WeCom |
| Properties | Dictionary | 自定义属性,随日志一起发送 | | |
| DateTimeFormat | string | 日期时间格式化 | | yyyy\-MM\-dd HH:mm:ss\.fff |
| ChannelCapacity | int? | 发送日志队列容量,为null表示不限制 | | null |
| MaximumLogCharLength | int? | 日志发送最大字符长度,若为null,则不限制 | | null |
| MaximumExceptionCharLength | int? | 异常发送最大字符长度,若为null,则不限制 | | null |
| OnlyException | bool | 是否仅发送有异常的日志 | | false |
| IgnoreExceptions | HashSet | 忽略的异常类型全名 | | |