private static void Load() { string leveljson = EditorPrefs.GetString("Log Levels", "{\"levels\": [] }"); LogLevelContainer levelContainer = JsonUtility.FromJson <LogLevelContainer>(leveljson); List <LogSettings.Level> levels = levelContainer.levels; foreach (LogSettings.Level level in levels) { LogFactory.GetLogger(level.Name).filterLogType = level.level; } }
private static void Save() { var levels = LogFactory.loggers.Select(kvp => new LogSettings.Level { Name = kvp.Key, level = kvp.Value.filterLogType }).ToList(); var levelContainer = new LogLevelContainer(levels); string leveljson = JsonUtility.ToJson(levelContainer); EditorPrefs.SetString("Log Levels", leveljson); }