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); } }
public void Write(string log, StatLogType type) { StatLogger logger = null; if (LoggerList.TryGetValue(type, out logger)) { logger.Write(log, type); } }