当前位置:网站首页>Nlog自定义时间
Nlog自定义时间
2022-08-02 22:25:00 【@榴莲酥】
第一步重写 TimeSource类
/// <summary>
/// 自定义时间,网关里是的标准时间,这里我修改成北京时间
/// </summary>
[TimeSource("CustomTimeZone")]
public class CustomTimeZoneTimeSource : TimeSource
{
public override DateTime Time
{
get
{
return DateTime.UtcNow.AddHours(8);//这里你可以自定义返回时间
}
}
public override DateTime FromSystemTime(DateTime systemTime)
{
return DateTime.UtcNow.AddHours(8);//这里你可以自定义返回时间
}
}第二步,实现刚才重写的类,即可
TimeSource.Current = new CustomTimeZoneTimeSource();
GitHub Nlog自定义时间说明地址:
边栏推荐
猜你喜欢
随机推荐
Tanabata is here - the romance of programmers
APT级全面免杀拿Shell
[TypeScript] Deep Learning of TypeScript Classes (Part 1)
TCP三次握手与四次挥手
Rebound shell principle and implementation
PHP实现登录失败三次需要输入验证码需求
centos7安装mysql8
典型相关分析CCA计算过程
【斯坦福计网CS144项目】Lab5: NetworkInterface
Ruoyi integrates minio to realize distributed file storage
Go语言如何操作文件
ML之PDP:基于titanic泰坦尼克是否获救二分类预测数据集利用PDP部分依赖图对RF随机森林和LightGBM模型实现可解释性案例
多租户的多种实现方案
Auto.js脚本程序打包
threejs dynamically adjust the camera position so that the camera can see the object exactly
qt静态编译出现Project ERROR: Library ‘odbc‘ is not defined
Word2Vec词向量训练、使用及可视化操作
You and I will meet the needs of: how to export the data in a MySQL simple ~!Practical!
MySQL删除数据后,释放磁盘空间
浅读一下dotenv的主干逻辑的源码


![[论文总结] 深度学习在农业领域应用论文笔记10](/img/e8/0ba741980495cd81ca30bf269d1111.jpg)






