NiuX.LogPanel
0.1.0
See the version list below for details.
dotnet add package NiuX.LogPanel --version 0.1.0
NuGet\Install-Package NiuX.LogPanel -Version 0.1.0
<PackageReference Include="NiuX.LogPanel" Version="0.1.0" />
paket add NiuX.LogPanel --version 0.1.0
#r "nuget: NiuX.LogPanel, 0.1.0"
// Install NiuX.LogPanel as a Cake Addin #addin nuget:?package=NiuX.LogPanel&version=0.1.0 // Install NiuX.LogPanel as a Cake Tool #tool nuget:?package=NiuX.LogPanel&version=0.1.0
LogPanel
NuGet:https://www.nuget.org/packages/NiuX.LogPanel/
LogPanel 是在 Github 上开源的 NetStandard 项目, 它旨在帮助开发人员排查项目运行中出现错误时快速查看日志排查问题,适用于小型或初期项目进行快速过渡。
在 .NET 平台上,通常我们会在项目中使用 NLog、Log4Net 和 Serilog 等日志组件,它们用于记录日志的功能非常强大和完整,常见情况会将日志写到 txt
或 数据库
中, 但通过记事本和 sql 查看日志并不简单方便. LogPanel 提供了一个可以简单快速查看日志的面板。
LogPanel 适用于 aspnetcore 2.x - aspnetcore5.x 项目, 采用 aspnetcore中间件
技术开发,轻量快速。
前端主要采用 Bootstrap(4.6)和 jQuery(3.6)。
快速开始
Install-Package NiuX.LogPanel
配置服务
public void ConfigureServices(IServiceCollection services) { // 新增方法 services.AddLogPanel(); }
配置中间件
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { // 新增方法 app.UseLogPanel(); }
启动后导航到路径:
/logpanel
日志组件配置示例(NLog)
这里假设第一次配置日志组件,如果已经接入请忽略。
- 安装包
Install-Package NLog.Web.AspNetCore
引入配置文件(目前只支持
||
分割符)<?xml version="1.0" encoding="utf-8" ?> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true" throwExceptions="false" internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log"> <variable name="myvar" value="myvalue"/> <targets> <target xsi:type="file" name="File" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate}||${level}||${logger}||${message}||${exception:format=ToString:innerFormat=ToString:maxInnerExceptionLevel=10:separator=\r\n}||end" /> </targets> <rules> <logger name="*" minlevel="Debug" writeTo="file" /> </rules> </nlog>
Program.cs 中配置启用
public class Program { public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { // 调用 UseNLog() webBuilder.UseStartup<Startup>().UseNLog(); }); }
页面预览
首页
实时查看应用程序运行中产生的日志
- 日志聚合
- 趋势图表
- 最近 N 条日志
列表
详情
复合检索所有日志并查看详情等操作
特性
- 授权访问
- 自定义日志模型
- 日志追踪
- 堆栈查看
支持的组件
日志
- NLog
- Log4Net
- Serilog
数据源
- txt
- 数据库
参考 & 感谢
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Dapper (>= 2.0.90)
- DapperExtensions.Standard (>= 1.1.0)
- Microsoft.AspNetCore.Authorization (>= 5.0.6)
- Microsoft.AspNetCore.Authorization.Policy (>= 2.2.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- NiuX.Extensions (>= 0.0.4)
- System.Linq.Dynamic.Core (>= 1.2.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.