zoukankan      html  css  js  c++  java
  • 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");

        }

    }

  • 相关阅读:
    day19 反射
    Oracle函数整理
    在博客园设置访问人数
    数据库中行转列
    Oracle中数据库与实例的区别
    sql语句的执行顺序
    【地址】ps_cs6安装
    ORA-12514 TNS 监听程序当前无法识别连接描述符中请求服务 的解决方法
    人员管理模块密码过期
    相关性配置模块总结
  • 原文地址:https://www.cnblogs.com/fanweisheng/p/11127064.html
Copyright © 2011-2022 走看看