log4net配置太复杂,我在写一个类似的结构,请帮我完善一下,谢谢。

wtoeb 2016-12-22 10:56:06
namespace BaseLib
{
public class Test
{
public ILogExt LogExt = LogExtAct.GetLogger(typeof(Test));
public void Main()
{
LogExt.Info("hi !"); // 显示效果: 2016-12-22 12:12:12 BaseLib.Test hi !
}
}
public interface ILogExt
{
void Info(object message);
}
public sealed class LogExtAct
{
public static ILogExt GetLogger(string name)
{
return null; // name; // 这里应该怎么写?谢谢。
}
public static ILogExt GetLogger(Type type)
{
return null; // (Assembly.GetCallingAssembly(), type.FullName); // 这里应该怎么写?谢谢。
}
}
public class LogExtImpl : ILogExt
{
public void Info(object message)
{
var txt = DateTime.Now + "" + message;
Console.WriteLine(txt);
// throw new NotImplementedException();
}
}
}
...全文
135 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
那你用nlog,或者entlib的log模块(这个配置更麻烦,但优点在于配套了配置工具,所以配制简单了)

111,098

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧