SuperSocket 日志接口
SuperSocket的日志功能非常简单,你几乎可以在任何地方都能记录日志。 AppServer 和 AppSession 都有Logger属性, 你可以直接用它来记录日志。
以下代码演示了日志接口的使用:
A -
/// <summary>
/// PolicyServer base class
/// </summary>
public abstract class PolicyServer : AppServer<PolicySession, BinaryRequestInfo>
{
......
/// <summary>
/// Setups the specified root config.
/// </summary>
/// <param name="rootConfig">The root config.</param>
/// <param name="config">The config.</param>
/// <returns></returns>
protected override bool Setup(IRootConfig rootConfig, IServerConfig config)
{
m_PolicyFile = config.Options.GetValue("policyFile");
if (string.IsNullOrEmpty(m_PolicyFile))
{
if(Logger.IsErrorEnabled)
Logger.Error("Configuration option policyFile is required!");
return false;
}
return true;
}
......
}
B -
public class RemoteProcessSession : AppSession<RemoteProcessSession>
{
protected override void HandleUnknownRequest(StringRequestInfo requestInfo)
{
Logger.Error("Unknow request");
}
}
最新文章
- redux的中间层 --reactjs学习
- cocos2dx day 2 - Sprites
- 上班遇到的——关于Web安全
- Mysql --分区表(2)
- Python--matplotlib绘图可视化知识点整理
- 桐桐的贸易--WA
- hadoop2.x通过Zookeeper来实现namenode的HA方案以及ResourceManager单点故障的解决方案
- 2dx解析cocosbuilder中使用layer时的缺陷
- 3.x的触摸响应机制
- java Spring集合
- 获取DOM的真实节点
- mac下通过docker搭建LEMP环境
- Spring Cache抽象详解
- POJThe Doors AND NYIST 有趣的问题
- java web.xml listener servlet 和filter加载顺序
- 【 js 模块加载 】深入学习模块化加载(node.js 模块源码)
- 模拟controfile丢失与重建
- UVA11853-Paintball(对偶图)
- android-如何获得当前正在运行的activity的相关信息
- .Net-using-Class:String 类