public static void WriteLog(Type type, string logContent, VLog4NetLevel log4Level) { ILog log = type == null?LogManager.GetLogger("") : LogManager.GetLogger(type); switch (log4Level) { case VLog4NetLevel.Warn: log.Warn(logContent); break; case VLog4NetLevel.Debug: log.Debug(logContent); break; case VLog4NetLevel.Info: log.Info(logContent); break; case VLog4NetLevel.Fatal: log.Fatal(logContent); break; case VLog4NetLevel.Error: log.Error(logContent); break; } }
public static void WriteLog(string logContent, VLog4NetLevel log4Level, Dictionary <string, string> cusProperties) { foreach (KeyValuePair <string, string> property in cusProperties) { log4net.LogicalThreadContext.Properties[property.Key] = property.Value; } WriteLog(null, logContent, log4Level); }
public static void WriteLog2(string uName, string machine, string url, string oModule, string op, string vId, int lType, VLog4NetLevel lLevel, string msg) { var ret = GetVideoLog(vId, "", uName); if (ret.Count > 0) { return; } var sql = "INSERT INTO [NPITrace].[dbo].[VideoLog] ([UserName],[Machine],[Url],[OperateModule],[Operate],[VideoID],[LogType],[LogLevel],[Message],[CreateAt]) VALUES (@uname, @machine, @url, @module, @operate, @vid, @ltype, @llevel, @msg, @date)"; var dic = new Dictionary <string, string>(); dic.Add("@uname", uName); dic.Add("@machine", machine); dic.Add("@url", url); dic.Add("@module", oModule); dic.Add("@operate", op); dic.Add("@vid", vId); dic.Add("@ltype", lType.ToString()); dic.Add("@llevel", "INFO"); dic.Add("@msg", msg); dic.Add("@date", DateTime.Now.ToString()); DBUtility.ExeLocalSqlNoRes(sql, dic); }
public static void WriteLog(string uName, string machine, string url, string oModule, string op, string vId, int lType, VLog4NetLevel lLevel, string msg) { var ret = GetVideoLog(vId, "", uName); if (ret.Count > 0) { return; } var dic = new Dictionary <string, string>(); dic.Add("uname", uName); dic.Add("machine", machine); dic.Add("url", url); dic.Add("module", oModule); dic.Add("operate", op); dic.Add("vid", vId); dic.Add("ltype", lType.ToString()); VLogHelper.WriteLog(msg, lLevel, dic); }