标签:ram socket 代码 get pps The roo return oid
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");
}
}
标签:ram socket 代码 get pps The roo return oid
原文地址:https://www.cnblogs.com/fanweisheng/p/11127064.html