예제 #1
0
        public void CreateLogger(StatLogType type)
        {
            int periodTime = 5;

            switch (type)
            {
            case StatLogType.COST:
            case StatLogType.LOGIN:
            case StatLogType.UPGRADE:
            case StatLogType.REGISTER:
            case StatLogType.RECHARGE:
            case StatLogType.ONLINE:
            case StatLogType.LOGOUT:
            case StatLogType.AU:
            case StatLogType.CONSUME:
                periodTime = 5;
                break;

            case StatLogType.LISTENCHAT:
            case StatLogType.EQUIP:
                periodTime = 10;
                break;
            }
            StatLogger logger = new StatLogger(serverKey, prefix, periodTime, type);

            if (LoggerList.ContainsKey(type))
            {
                LoggerList[type] = logger;
            }
            else
            {
                LoggerList.Add(type, logger);
            }
        }
예제 #2
0
        public void Write(string log, StatLogType type)
        {
            StatLogger logger = null;

            if (LoggerList.TryGetValue(type, out logger))
            {
                logger.Write(log, type);
            }
        }
예제 #3
0
 public StatLogger(string server_key, string prefix, int refresh_time, StatLogType type)
 {
     this.serverKey   = server_key;
     this.refreshTime = refresh_time;
     // prefix = serverName_param
     // e.g. ZoneServer_1_1 ManagerServcer_1 BarrackServer_2
     this.prefix = prefix;
     this.type   = type;
     if (IsSpecStatLogType(type))
     {
         Dir = "c:/SpecStatLog/";
     }
     else
     {
         Dir = "c:/StatLog/";
     }
     CreateNewLogFile();
 }
예제 #4
0
        private bool IsSpecStatLogType(StatLogType type)
        {
            switch (type)
            {
            case StatLogType.COST:
            case StatLogType.LOGIN:
            case StatLogType.UPGRADE:
            case StatLogType.REGISTER:
            case StatLogType.RECHARGE:
            case StatLogType.ONLINE:
            case StatLogType.LOGOUT:
            case StatLogType.AU:
                return(false);

            default:
                return(true);
            }
        }
예제 #5
0
        public void Write(string log, StatLogType type)
        {
            try
            {
                log += '|' + serverKey + '_' + type.ToString();
                //tw.WriteLine(log);
            }
            catch (Exception e)
            {
                Log.Warn(e.ToString());
            }

            /*
             * writeLength += log.Length;
             * if (writeLength >= fileSize)
             * {
             *  tw.Close();
             *  CreateNewLogFile();
             * }
             */
        }