using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Common.LogUtil
{
public struct LogInformation
{
///
/// 使用指定值创建日志信息的新实例
///
/// 异常对象
/// 客户端IP
/// 附加消息
/// 操作者姓名
/// 异常客户端设备类别
/// 返回新的日志信息实例
public static LogInformation CreateLogInformation(Exception ex, string clientIP, string extendMsg, string userName, string sourceDevice)
{
return new LogInformation()
{
CLIENTIP = clientIP,
CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
EXMESSAGE = ex.Message,
EXSOURCE = ex.Source,
EXTENDMESSAGE = extendMsg,
HELPLINK = ex.HelpLink,
OPERATEUSER = userName,
SOURCEDEVICE = sourceDevice,
STACKTRACE = ex.StackTrace,
TARGETSITE = ex.TargetSite.Name
};
}
///
/// 日志主键
///
public string PID;
///
/// 帮助链接
///
public string HELPLINK;
///
/// 异常消息
///
public string EXMESSAGE;
///
/// 异常源
///
public string EXSOURCE;
///
/// 异常堆栈信息
///
public string STACKTRACE;
///
/// 引发异常的方法
///
public string TARGETSITE;
///
/// 创建时间
///
public string CREATETIME;
///
/// 操作者
///
public string OPERATEUSER;
///
/// 扩展消息
///
public string EXTENDMESSAGE;
///
/// 产生异常设备
///
public string SOURCEDEVICE;
///
/// 客户端IP
///
public string CLIENTIP;
}
}