/// <summary> /// 过长的数据在日志中不显示 /// </summary> /// <param name="orilog">原请求</param> /// <param name="ignore">需要过滤的参数</param> private string RemoveIgnoreLog(string orilog, params string[] ignore) { if (string.IsNullOrWhiteSpace(orilog) || ignore == null || ignore.Length < 1) { return orilog; } foreach (var item in ignore) { Regex pattern = new Regex(@"""" + item + @""":\s?""(.+?)"""); orilog = pattern.Replace(orilog, @"""" + item + @""":""数据过长,不写入日志"""); } return orilog; }
标签:Regex,string,item,C#,ignore,正则表达式,JSON,orilog From: https://www.cnblogs.com/ywtssydm/p/17633751.html