T4LogS.AspCore
1.0.0
dotnet add package T4LogS.AspCore --version 1.0.0
NuGet\Install-Package T4LogS.AspCore -Version 1.0.0
<PackageReference Include="T4LogS.AspCore" Version="1.0.0" />
paket add T4LogS.AspCore --version 1.0.0
#r "nuget: T4LogS.AspCore, 1.0.0"
// Install T4LogS.AspCore as a Cake Addin
#addin nuget:?package=T4LogS.AspCore&version=1.0.0
// Install T4LogS.AspCore as a Cake Tool
#tool nuget:?package=T4LogS.AspCore&version=1.0.0
T4LogS - T4 Logs System
What is T4LogS?
The main target: Support for storing Exception information arising from many different projects becomes easier with centralized storage.
Microservices architecture, T4LogS support recording Exception from Small-Services with centralized storage.
In addition to the main information from Exception: Message, StackTrace. T4LogS also stores more information from Exception's properties.
Support classification T4LogSType: Error, Warning, Log, Info, Debug, Audit, Time, Other.
T4LogSWriteTime: Support for programmers to record the execution time of any Function (Method) in units: ns, ms, s.
Future, T4LogS will develop classes for methods Get, Read log files.
Target Framework
.NET Standard 2.0
View More:
- https://github.com/dotnet/standard/blob/master/docs/versions/netstandard2.0.md
- https://docs.microsoft.com/en-us/dotnet/standard/net-standard
Installation Nuget Package
T4LogS.Core (Main)
https://www.nuget.org/packages/T4LogS.Core
T4LogS.AspCore (ASP.NET Core)
https://www.nuget.org/packages/T4LogS.AspCore
Using the Code
- Initial Configuration (CALLING ONLY ONE in Project)
T4LogS.Core.T4LogSOptions option = new Core.T4LogSOptions() {
//File custom: view live file exception
BreakLineCustom = "<br>",
ExtensionCustom = "html",
SaveFileCustom = true,
FormatTextCustom = "",//Required to use the correct format
//File custom: End
SaveDetails = true,// View details: get all property exception
LogsPath = Server.MapPath("T4LogS"),//Folder save file log
options.SaveFileJson = true,// Accept save file json
};
- Using try-catch in code
try
{
int.Parse("a");
}
catch (Exception ex)
{
//Write log fast
new T4LogS.Core.T4LogSWriteException(ex, Core.T4LogSType.Error, "Description (Optional, default String.Empty)").Dispose();
//or write append detail
using (var log = new T4LogS.Core.T4LogSWriteException(ex, Core.T4LogSType.Error))
{
log.AppendDetail(new Core.T4LogSDetail()
{
Name = "Example Append Name",
TargetName = "Example Append Target Name",
Value = "Example Append Value",
});
}
}
- Using UseExceptionHandler for ASP.NET Core
//File Startup.cs
public void ConfigureServices(IServiceCollection services){
services.AddT4LogS(options =>
{
//Initial Configuration
options.SaveFileCustom = true;
options.SaveDetails = true;
options.SaveFileJson = true;
});
...
services.AddMvc();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
//app.UseExceptionHandler("/Home/Error");//Default ASP.NET CORE
app.UseExceptionHandler((Action<IApplicationBuilder>)(options =>
{
options.Run((RequestDelegate)(async (context) =>
{
var error = await T4LogSExtensions.Execute(context, "Description (Optional, default String.Empty). Example: Username login from SESSION");
System.Diagnostics.Debug.WriteLine(error.Exception);//Optional: Write Debug
await context.Response.WriteAsync(error.Object.Message);//Optional: Write Response page
}));
}));
}
}
- Using ASP.NET MVC Framework
//File Global.asax
protected void Application_Start()
{
...
T4LogS.Core.T4LogSOptions option = new Core.T4LogSOptions() {
LogsPath = Server.MapPath("T4LogS")
};
}
protected void Application_Error(object sender, EventArgs e)
{
using (var t4log = new Core.T4LogSWriteException(Server.GetLastError(), Core.T4LogSType.Error, "Description (Optional, default String.Empty). Example: Username login from SESSION"))
{
System.Diagnostics.Debug.WriteLine(t4log.Exception);//Optional: Write Debug
}
}
License
This article, along with any associated source code and files, is licensed under MIT
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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. 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.0
- Microsoft.AspNetCore (>= 2.1.0)
- T4LogS.Core (>= 1.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 765 | 4/16/2021 |