protected static void Log(bool save, string action, object id, object data, Type type) { if (!save) { return; } string json = Jsonlizer.ToJson(data, 20, true, true); // 序列化为json,并跳过复杂的属性 string txt = string.Format("{0}: ID={1}, Type={2}, Data={3}", action, id, type, json); UtilConfig.Log("Database", txt); }
static void Log(bool log, string action, string id, Type type, object data) { if (!log) { return; } string json = Jsonlizer.ToJson(data, 20, true, true); // 序列化为json,跳过复杂的属性 string txt = string.Format("{0}数据,ID={1}, Type={2}, Data={3}", action, id, type, json); Logger.LogToDb(txt); }