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.
 
 
 
 

78 lines
1.9 KiB

using learun.iapplication;
using learun.util;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace learun.application
{
/// <summary>
/// 版 本 EasyCode EC管理后台
/// Copyright (c) 2019-present EC管理有限公司
/// 创建人:tobin
/// 日 期:2019.09.25
/// 描 述:系统日志
/// </summary>
public class LogBLL : LogIBLL
{
private readonly LogService service = new LogService();
#region 获取数据
/// <summary>
/// 日志列表
/// </summary>
/// <param name="pagination">分页</param>
/// <param name="queryJson">查询参数</param>
/// <param name="userId">用户主键</param>
/// <returns></returns>
public Task<IEnumerable<LogEntity>> GetPageList(Pagination pagination, string queryJson, string userId)
{
return service.GetPageList(pagination, queryJson, userId);
}
#endregion 获取数据
#region 提交数据
/// <summary>
/// 清空日志
/// </summary>
/// <param name="categoryId">日志分类Id</param>
/// <param name="keepTime">保留时间段内</param>
public async Task Remove(int categoryId, string keepTime)
{
await service.Remove(categoryId, keepTime);
}
/// <summary>
/// 写日志
/// </summary>
/// <param name="logEntity">对象</param>
public async Task Write(LogEntity logEntity)
{
await service.Write(logEntity);
}
#endregion 提交数据
#region 扩展方法
/// <summary>
/// 生成异常信息
/// </summary>
/// <param name="ex">异常对象</param>
/// <returns></returns>
public string ExceptionFormat(Exception ex)
{
StringBuilder strInfo = new StringBuilder();
strInfo.Append("1. 异常: " + ex.Message + "\r\n");
strInfo.Append("2. 来源: " + ex.Source + "\r\n");
strInfo.Append("3. 实例: " + ex.StackTrace + "\r\n");
return strInfo.ToString();
}
#endregion 扩展方法
}
}