天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

81 lines
2.4 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Common.LogUtil
{
public struct LogInformation
{
/// <summary>
/// 使用指定值创建日志信息的新实例
/// </summary>
/// <param name="ex">异常对象</param>
/// <param name="clientIP">客户端IP</param>
/// <param name="extendMsg">附加消息</param>
/// <param name="userName">操作者姓名</param>
/// <param name="sourceDevice">异常客户端设备类别</param>
/// <returns>返回新的日志信息实例</returns>
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
};
}
/// <summary>
/// 日志主键
/// </summary>
public string PID;
/// <summary>
/// 帮助链接
/// </summary>
public string HELPLINK;
/// <summary>
/// 异常消息
/// </summary>
public string EXMESSAGE;
/// <summary>
/// 异常源
/// </summary>
public string EXSOURCE;
/// <summary>
/// 异常堆栈信息
/// </summary>
public string STACKTRACE;
/// <summary>
/// 引发异常的方法
/// </summary>
public string TARGETSITE;
/// <summary>
/// 创建时间
/// </summary>
public string CREATETIME;
/// <summary>
/// 操作者
/// </summary>
public string OPERATEUSER;
/// <summary>
/// 扩展消息
/// </summary>
public string EXTENDMESSAGE;
/// <summary>
/// 产生异常设备
/// </summary>
public string SOURCEDEVICE;
/// <summary>
/// 客户端IP
/// </summary>
public string CLIENTIP;
}
}