2 Star 17 Fork 7

s0611163 / LogUtil

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

LogUtil

一个简单的日志工具类,无需配置,不依赖第三方库

集成了NLog和log4net,以便于对比测试

性能

  1. 单进程,Windows下性能和NLog差不多,Linux下性能比NLog好

  2. 多进程,Windows下性能不如NLog,Linux下性能和NLog差不多

如何使用

NuGet

https://www.nuget.org/packages/LogUtil

单进程

LogUtil.Info("Info日志");
LogUtil.Debug("Debug日志");
LogUtil.Error("Error日志");
LogUtil.Error(ex, "Error日志");
LogUtil.Error("Error日志", ex);

多进程

//使用前请设置SupportMultiProcess为true,即支持多进程
LogUtil.SupportMultiProcess = true;
LogUtil.Info("Info日志");
LogUtil.Debug("Debug日志");
LogUtil.Error("Error日志");
LogUtil.Error(ex, "Error日志");
LogUtil.Error("Error日志", ex);

设置写入Debug文件的日志级别和写入Info文件的日志级别

LogUtil.WriteToDebug = LogLevel.Debug | LogLevel.Info | LogLevel.Error;
LogUtil.WriteToInfo = LogLevel.Info | LogLevel.Error;
MIT License Copyright (c) 2021 0611163 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

一个简单的日志工具类,无需配置,集成了NLog和log4net,以便于对比测试 展开 收起
C#
MIT
取消

发行版 (4)

全部

贡献者

全部

近期动态

加载更多
不能加载更多了
C#
1
https://gitee.com/s0611163/LogUtil.git
git@gitee.com:s0611163/LogUtil.git
s0611163
LogUtil
LogUtil
main

搜索帮助

14c37bed 8189591 565d56ea 8189591