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");

        }

    }

  • 相关阅读:
    Could not update ICEauthority file /var/lib/gdm/.ICEauthority
    反爬虫中技术点的定义
    反爬虫一些问题
    反爬虫准备
    题解「BZOJ4621 Tc605」
    题解「ZJOI2019 语言」
    题解「清华集训2012 序列操作」
    题解「CF1174F Ehab and the Big Finale」
    题解「CF516D Drazil and Morning Exercise」
    题解「HNOI2018 寻宝游戏」
  • 原文地址:https://www.cnblogs.com/fanweisheng/p/11127064.html
Copyright © 2011-2022 走看看