本文整理汇总了C#中Log.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Log.Save方法的具体用法?C# Log.Save怎么用?C# Log.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log.Save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: QuickSave
private static void QuickSave(int type, string title,string message)
{
Log l = new Log();
l.Type = type;
l.Title = title;
l.Message = message;
l.Save("", DateTime.Now.AddHours(SiteSettings.Get().TimeZoneOffSet));
}
示例2: AddLog
public bool AddLog(List<LogEvent> logList)
{
using (IConnectinContext context = DBContext.Context1)
{
context.BeginTransaction();
foreach (var logEvent in logList)
{
Log log = new Log();
logEvent.MemberCopyTo(log);
log.ErrorTime = Convert.ToDateTime(logEvent.ErrorTime);
log.CreatedTime = DateTime.Now;
log.Save();
AddLogInnerException(logEvent.Errors, log.ID);
}
context.Commit();
return true;
}
}
示例3: Logon
public bool Logon(string login, string senha)
{
if (string.IsNullOrEmpty(login)) return false;
if (string.IsNullOrEmpty(senha)) return false;
this.Login = login;
this.Senha = senha;
this.Get();
if (this.IDUsuario == null) return false;
if (!this.Ativo) return false;
AdicionaSessao();
if (Cliente.Current() != null)
{
var log = new Log();
log.Descricao = "Usuário " + this.Login + " acessou o sitema em " + DateTime.Now.ToString("dd/MM/yyyy HH:mm");
log.Usuario = this;
log.Cliente = Cliente.Current();
log.Programa = Programa.Current();
log.Campanha = Campanha;
log.Tipo = TipoLog.Login;
log.Data = DateTime.Now;
log.Save();
}
return true;
}
示例4: Insert
public void Insert(DateTime LogDate,string Message,byte MessageType,string UserAgent,string RemoteHost,string AuthUser,string Referer,string MachineName,string FormData,string QueryStringData,string CookiesData,string ExceptionType,string ScriptName,string ExceptionMessage,string ExceptionSource,string ExceptionStackTrace)
{
Log item = new Log();
item.LogDate = LogDate;
item.Message = Message;
item.MessageType = MessageType;
item.UserAgent = UserAgent;
item.RemoteHost = RemoteHost;
item.AuthUser = AuthUser;
item.Referer = Referer;
item.MachineName = MachineName;
item.FormData = FormData;
item.QueryStringData = QueryStringData;
item.CookiesData = CookiesData;
item.ExceptionType = ExceptionType;
item.ScriptName = ScriptName;
item.ExceptionMessage = ExceptionMessage;
item.ExceptionSource = ExceptionSource;
item.ExceptionStackTrace = ExceptionStackTrace;
item.Save(UserName);
}
示例5: Write
public static void Write(Cxt cxt, string type, string category, string message)
{
Log log = new Log(cxt, 0);
log.Type = type;
log.Category = category;
log.Message = message;
log.Save();
}
示例6: Log
public static void Log(string logType, string category, string description, string entityName="", int entityId = 0)
{
Log log = new Log();
log.LogType = logType;
log.Category = category;
log.Description = description;
log.EntityName = entityName;
log.EntityId = entityId;
log.InsertUserId = Provider.User.Id;
log.Save();
}