当前位置:网站首页>C server log module
C server log module
2022-07-04 20:09:00 【Handsome_ shuai_】
C# Server log module
Configure logs for our server , So we can follow the rules ( For example, according to month / God / Hours This structure prints the log into the corresponding file ), In this way, we divide the log file into Named on mm / DD / yyyy In the generated log file , Prevent a single log file from being too large
Use NuGet In bag Serilog Package to collect logs
<ItemGroup>
<PackageReference Include="Serilog" Version="2.11.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
</ItemGroup>
- Create class library program , Easy to generate DLL For external direct use
- It's packaged twice
public class Logger
{
private static Serilog.Core.Logger coreLogger;
private static Logger warpLogger;
public static Serilog.Core.Logger Instance => coreLogger;
public Logger(string logFileName)
{
coreLogger = new LoggerConfiguration().
WriteTo.Console().
WriteTo.File($"{
logFileName}-.txt", rollingInterval: RollingInterval.Minute).
CreateLogger();
}
public static void Create(string logFileName)
{
warpLogger = (warpLogger == null) ? new Logger(logFileName) : warpLogger;
}
}
边栏推荐
- C language - Introduction - Foundation - grammar - process control (VII)
- Development and construction of DFI ecological NFT mobile mining system
- 黑马程序员-软件测试--08阶段2-linux和数据库-23-30-进程端口相关,修改文件权限,端口号信息的获取,程序和进程相关操作,linux命令案例
- The company needs to be monitored. How do ZABBIX and Prometheus choose? That's the right choice!
- node_ Exporter deployment
- Online text line fixed length fill tool
- 更强的 JsonPath 兼容性及性能测试之2022版(Snack3,Fastjson2,jayway.jsonpath)
- 2022 Health Exhibition, health exhibition, Beijing Great Health Exhibition and health industry exhibition were held in November
- kotlin 继承
- 做社交媒体营销应该注意些什么?Shopline卖家的成功秘笈在这里!
猜你喜欢
The explain statement in MySQL queries whether SQL is indexed, and several types in extra collate and summarize
TCP waves twice, have you seen it? What about four handshakes?
Employment prospects of neural network Internet of things application technology [welcome to add]
Creation of JVM family objects
abc229 总结(区间最长连续字符 图的联通分量计数)
What should we pay attention to when doing social media marketing? Here is the success secret of shopline sellers!
Euler function
线上数据库迁移的几种方法
Chrome development tool: what the hell is vmxxx file
Free soldier
随机推荐
@Data source connection pool exhaustion caused by transactional abuse
Stream stream
English语法_名词 - 使用
Pythagorean number law (any three numbers can meet the conditions of Pythagorean theorem)
做社交媒体营销应该注意些什么?Shopline卖家的成功秘笈在这里!
node_ Exporter deployment
更强的 JsonPath 兼容性及性能测试之2022版(Snack3,Fastjson2,jayway.jsonpath)
Some thoughts on whether the judgment point is located in the contour
多表操作-外连接查询
Kotlin cycle control
2022 Health Exhibition, Beijing Health Expo, China Health Exhibition, great health exhibition November 13
kotlin 基本数据类型
Pointnext: review pointnet through improved model training and scaling strategies++
In operation (i.e. included in) usage of SSRs filter
Add namespace declaration
项目中遇到的线上数据迁移方案1---总体思路整理和技术梳理
2022 version of stronger jsonpath compatibility and performance test (snack3, fastjson2, jayway.jsonpath)
What should we pay attention to when doing social media marketing? Here is the success secret of shopline sellers!
Educational Codeforces Round 22 E. Army Creation
[problem] Druid reports exception SQL injection violation, part always true condition not allow solution