RuoVea.OmiApi.Log 8.0.0.3

dotnet add package RuoVea.OmiApi.Log --version 8.0.0.3
                    
NuGet\Install-Package RuoVea.OmiApi.Log -Version 8.0.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RuoVea.OmiApi.Log" Version="8.0.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RuoVea.OmiApi.Log" Version="8.0.0.3" />
                    
Directory.Packages.props
<PackageReference Include="RuoVea.OmiApi.Log" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RuoVea.OmiApi.Log --version 8.0.0.3
                    
#r "nuget: RuoVea.OmiApi.Log, 8.0.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=RuoVea.OmiApi.Log&version=8.0.0.3
                    
Install RuoVea.OmiApi.Log as a Cake Addin
#tool nuget:?package=RuoVea.OmiApi.Log&version=8.0.0.3
                    
Install RuoVea.OmiApi.Log as a Cake Tool

RuoVea.OmiApi.Log

介绍:

日志管理 API

日志管理 API(RuoVea.OmiApi.Log):基于.Net5.0 、.Net6.0 、.Net7.0、.Net8.0构建的简单、跨平台的系统。 系统业务简单、代码清晰,如果您只是单纯只需简单增、删、改、查。没有多余的功能,简单扩展下基本可以满足日常需求。 支持的数据库有 MySql、SqlServer、PostgreSQL、SQLite、Oracle...

安装教程

Install-Package RuoVea.OmiApi.Log

/*类库映射API组件*/
if (builder.Environment.IsProduction())
{
    builder.Services.AddDynamicWebApi(options =>
    {
        options.DefaultApiPrefix = "/openapi/api";
        options.RemoveControllerPostfixes = new List<string> { "AppService", "Service" };
        options.RemovePrefix = new List<string> { "get", "post" };
    });
}
else
{
    builder.Services.AddDynamicWebApi(options =>
    {
        options.RemoveControllerPostfixes = new List<string> { "AppService", "Service" };
        options.RemovePrefix = new List<string> { "get", "post" };
    });
}
builder.Services.AddOmiLogSetup();/* 应用接口*/
builder.Services.AddSqlSugarSetup();/* 扩展ORM */
builder.Services.AddLogInitSetup();/* 初始化表和种子数据 */

示例

builder.Services
    .AddRestFulLogSetup<CustomizeSqlSugarLog>()
    .AddSqlSugarSetup();

builder.Services
    .AddRestfulSetup<CustomizeFilterLog>()
    .RequestActionSetup() // 注入 请求日志拦截 [执行操作日志、参数验证 ]
    .ExceptionSetup()

SuGarLog
/// <summary>
/// 
/// </summary>
public class CustomizeSqlSugarLog : ICustomizeSqlSugarLog
{
    /// <summary>
    /// 
    /// </summary>
    public CustomizeSqlSugarLog(IOptions<List<DbConnectionConfig>> dbConnection) : base(dbConnection)
    {
    }
    /// <summary>
    /// 异常脚本记录
    /// </summary>
    /// <param name="sql"></param>
    public override void SugarErrorLogString(string sql)
    {
        Console.WriteLine(sql);
    }
    /// <summary>
    /// 执行脚本记录
    /// </summary>
    /// <param name="sql"></param>
    public override void SugarExecutingLogString(string sql)
    {
        Console.WriteLine(sql);
    }
}
FileLog
/// <summary>
/// 
/// </summary>
public class CustomizeFilterLog : ICustomizeFilterLog
{
    /// <summary>
    /// 
    /// </summary>
    public CustomizeFilterLog(IOptions<List<DbConnectionConfig>> dbConnection):base(dbConnection)
    {
    }
    /// <summary>
    /// 操作日志
    /// </summary>
    /// <param name="operation"></param>
    /// <returns></returns>
    public override bool LogOp(ExFilter.Domain.OperationVo operation)
    {
        List<string> ignoreUrls = new List<string> { "pages", "Index" };
        return ignoreUrls.Contains(operation.ActionName);
    }

    /// <summary>
    /// 操作日志
    /// </summary>
    /// <param name="operation"></param>
    /// <returns></returns>
    public override bool LogVis(ExFilter.Domain.OperationVo operation)
    {
        List<string> ignoreUrls = new List<string> { "pages", "Index" };
        return operation.Url == "/logex/pages";
    }
}

配置信息


  /* 数据库链接 具体配置见SqlSugar官网(第一个为默认库不需要设置ConfigId)*/
  "ConnectionConfigs": [
    {
      "DbType": "Sqlite", /*MySql、SqlServer、Sqlite、Oracle、PostgreSQL、Dm、Kdbndp、Oscar、MySqlConnector、Access、OpenGauss、QuestDB、HG、ClickHouse、GBase、Odbc、Custom */
      "ConnectionString": "DataSource=./ruovea.db", /*库连接字符串*/
      //"EnableUnderLine": false, /*启用驼峰转下划线*/
      //"EnableDiffLog": false, /*启用库表差异日志*/

      //"IsEncrypt": false, /*是否加密*/
      //"DbSecurity": "", /*链接字符串解密密钥*/

      //"IsDeleteFilter": true, /*查询删除过滤 实体需继承 IDeletedEntity*/
      //"IsUserIdFilter": false, /*查询过滤器默认为false,true的时候;当有用户cretor的时候将及时过滤 实体需继承ICreatorFilter或EntityBase*/
      //"IsTenantIdFilter": false, /*查询过滤器 默认为false,true的时候;当有用户cretor的时候将及时过滤 实体需继承 ITenantIdFilter*/
      //"CommandTimeOut": 30 /*设置 SQL 执行的超时时间(默认30)分钟 */
    }
  ]
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on RuoVea.OmiApi.Log:

Package Downloads
RuoVea.OmiLog

字典管理

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.0.0.3 165 4/8/2025
8.0.0.2 156 4/3/2025
8.0.0.1 154 3/31/2025
8.0.0 230 3/4/2025
7.0.0.3 161 4/8/2025
7.0.0.2 157 4/3/2025
7.0.0.1 150 3/31/2025
7.0.0 235 3/4/2025
6.0.0.7 183 4/8/2025
6.0.0.6 161 4/3/2025
6.0.0.5 154 3/31/2025
6.0.0.4 258 3/4/2025
6.0.0.3 268 11/8/2024
6.0.0.2 135 11/4/2024
6.0.0.1 107 11/2/2024
6.0.0 98 10/28/2024