private void OnC2SSetLoggerLogLevelRequest(ServerLogMessage message) { string jsonStr = Encoding.UTF8.GetString(message.Message); LogNetLoggerSetting loggerSetting = JsonConvert.DeserializeObject <LogNetLoggerSetting>(jsonStr); if (loggerSetting != null) { if (LogUtil.Loggers.TryGetValue(loggerSetting.Name, out var logger)) { logger.MinLogLevel = loggerSetting.MinLogLevel; logger.StackTraceLogLevel = loggerSetting.StackTraceLogLevel; } } //m_ServerNetwork.SendMessage(LogNetUtill.S2C_SET_LOGGER_LOG_LEVEL_RESPONSE, message.Message); }
private void OnC2SGetLogLevelRequest(ServerLogMessage message) { LogNetSetting setting = new LogNetSetting(); setting.GlobalSetting = new LogNetGlobalSetting() { GlobalLogLevel = LogUtil.GlobalLogLevel, }; setting.LoggerSettings = new List <LogNetLoggerSetting>(); foreach (var kvp in LogUtil.Loggers) { LogNetLoggerSetting loggerSetting = new LogNetLoggerSetting() { Name = kvp.Value.Name, MinLogLevel = kvp.Value.MinLogLevel, StackTraceLogLevel = kvp.Value.StackTraceLogLevel, }; setting.LoggerSettings.Add(loggerSetting); } string settingJsonStr = JsonConvert.SerializeObject(setting); m_ServerNetwork.SendMessage(message.Client, LogNetUtill.S2C_GET_LOG_LEVEL_RESPONSE, Encoding.UTF8.GetBytes(settingJsonStr)); }