mirror of
https://github.com/nsnail/ns-ext.git
synced 2025-11-02 10:15:28 +08:00
<chore>
This commit is contained in:
@@ -1,89 +0,0 @@
|
||||
[*.{appxmanifest,asax,ascx,aspx,axaml,axml,build,config,cs,cshtml,csproj,css,dbml,discomap,dtd,htm,html,js,json,jsproj,jsx,lsproj,master,njsproj,nuspec,paml,proj,props,proto,razor,resjson,resw,resx,skin,StyleCop,targets,tasks,ts,tsx,vb,vbproj,xaml,xamlx,xml,xoml,xsd}]
|
||||
indent_style = space
|
||||
indent_size = space
|
||||
tab_width = 4
|
||||
|
||||
[*]
|
||||
|
||||
# Microsoft .NET properties
|
||||
csharp_indent_braces = false
|
||||
csharp_new_line_before_members_in_object_initializers = true
|
||||
csharp_new_line_before_open_brace = local_functions, methods, types
|
||||
csharp_preferred_modifier_order = public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion
|
||||
csharp_style_var_elsewhere = true:suggestion
|
||||
csharp_style_var_for_built_in_types = true:suggestion
|
||||
csharp_style_var_when_type_is_apparent = true:suggestion
|
||||
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none
|
||||
dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:none
|
||||
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
|
||||
dotnet_style_predefined_type_for_member_access = true:suggestion
|
||||
dotnet_style_qualification_for_event = false:suggestion
|
||||
dotnet_style_qualification_for_field = false:suggestion
|
||||
dotnet_style_qualification_for_method = false:suggestion
|
||||
dotnet_style_qualification_for_property = false:suggestion
|
||||
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
|
||||
|
||||
# ReSharper inspection severities
|
||||
resharper_arrange_redundant_parentheses_highlighting = hint
|
||||
resharper_arrange_this_qualifier_highlighting = hint
|
||||
resharper_arrange_type_member_modifiers_highlighting = hint
|
||||
resharper_arrange_type_modifiers_highlighting = hint
|
||||
resharper_built_in_type_reference_style_for_member_access_highlighting = hint
|
||||
resharper_built_in_type_reference_style_highlighting = hint
|
||||
resharper_redundant_base_qualifier_highlighting = warning
|
||||
resharper_suggest_var_or_type_built_in_types_highlighting = hint
|
||||
resharper_suggest_var_or_type_elsewhere_highlighting = hint
|
||||
resharper_suggest_var_or_type_simple_types_highlighting = hint
|
||||
|
||||
# ReSharper properties
|
||||
resharper_align_first_arg_by_paren = true
|
||||
resharper_align_linq_query = true
|
||||
resharper_align_multiline_argument = true
|
||||
resharper_align_multiline_array_and_object_initializer = false
|
||||
resharper_align_multiline_calls_chain = true
|
||||
resharper_align_multiline_expression = true
|
||||
resharper_align_multiline_extends_list = true
|
||||
resharper_align_multiline_for_stmt = true
|
||||
resharper_align_multiline_property_pattern = true
|
||||
resharper_align_multiline_switch_expression = true
|
||||
resharper_align_multline_type_parameter_constrains = true
|
||||
resharper_align_multline_type_parameter_list = true
|
||||
resharper_align_tuple_components = true
|
||||
resharper_csharp_align_multiline_parameter = true
|
||||
resharper_csharp_align_multiple_declaration = true
|
||||
resharper_csharp_empty_block_style = together
|
||||
resharper_csharp_indent_size = 4
|
||||
resharper_csharp_indent_style = space
|
||||
resharper_csharp_insert_final_newline = true
|
||||
resharper_csharp_max_line_length = 120
|
||||
resharper_csharp_stick_comment = false
|
||||
resharper_csharp_tab_width = 4
|
||||
resharper_csharp_wrap_arguments_style = chop_if_long
|
||||
resharper_csharp_wrap_before_comma = false
|
||||
resharper_csharp_wrap_chained_method_calls = chop_if_long
|
||||
resharper_csharp_wrap_extends_list_style = chop_if_long
|
||||
resharper_csharp_wrap_parameters_style = chop_if_long
|
||||
resharper_indent_anonymous_method_block = true
|
||||
resharper_indent_nested_fixed_stmt = true
|
||||
resharper_indent_nested_foreach_stmt = true
|
||||
resharper_indent_nested_for_stmt = true
|
||||
resharper_indent_nested_lock_stmt = true
|
||||
resharper_indent_nested_usings_stmt = true
|
||||
resharper_indent_nested_while_stmt = true
|
||||
resharper_indent_preprocessor_if = usual_indent
|
||||
resharper_indent_preprocessor_other = usual_indent
|
||||
resharper_int_align = true
|
||||
resharper_keep_existing_arrangement = false
|
||||
resharper_keep_existing_linebreaks = false
|
||||
resharper_max_initializer_elements_on_line = 1
|
||||
resharper_outdent_commas = true
|
||||
resharper_outdent_dots = true
|
||||
resharper_wrap_array_initializer_style = chop_always
|
||||
resharper_wrap_before_comma = false
|
||||
resharper_wrap_object_and_collection_initializer_style = chop_always
|
||||
|
||||
[*.cs]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
tab_width = 4
|
||||
@@ -1,18 +0,0 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Authors>nsnail</Authors>
|
||||
<Product>NSExt</Product>
|
||||
<Copyright>© 2006-2022 nsnail</Copyright>
|
||||
<RepositoryUrl>https://github.com/nsnail/ns-ext.git</RepositoryUrl>
|
||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||
<EmbedUntrackedSource>true</EmbedUntrackedSource>
|
||||
<EmbedAllSources>true</EmbedAllSources>
|
||||
<RepositoryType>Git</RepositoryType>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<PackageProjectUrl>https://github.com/nsnail/ns-ext.git</PackageProjectUrl>
|
||||
<PackageOutputPath>../../build/nupkgs</PackageOutputPath>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -17,11 +17,11 @@ public static class DbCommandExtensions
|
||||
DbType.String or DbType.DateTime or DbType.Date or DbType.Time or DbType.DateTime2
|
||||
or DbType.DateTimeOffset or DbType.Guid or DbType.VarNumeric or DbType.AnsiStringFixedLength
|
||||
or DbType.AnsiString
|
||||
or DbType.StringFixedLength => sql.Replace(me.Parameters[i].ParameterName,
|
||||
"'" + me.Parameters[i].Value + "'"),
|
||||
DbType.Boolean => sql.Replace(me.Parameters[i].ParameterName,
|
||||
Convert.ToBoolean(me.Parameters[i].Value) ? "1" : "0"),
|
||||
_ => sql.Replace(me.Parameters[i].ParameterName, me.Parameters[i].Value?.ToString())
|
||||
or DbType.StringFixedLength =>
|
||||
sql.Replace(me.Parameters[i].ParameterName, "'" + me.Parameters[i].Value + "'")
|
||||
, DbType.Boolean => sql.Replace(me.Parameters[i].ParameterName
|
||||
, Convert.ToBoolean(me.Parameters[i].Value) ? "1" : "0")
|
||||
, _ => sql.Replace(me.Parameters[i].ParameterName, me.Parameters[i].Value?.ToString())
|
||||
};
|
||||
|
||||
return sql;
|
||||
@@ -10,10 +10,8 @@ public static class GenericExtensions
|
||||
/// <param name="copyObj">拷贝来源</param>
|
||||
/// <param name="propNameList">需要处理的属性名</param>
|
||||
/// <param name="isIncludeOrExclude">True包含,false排除</param>
|
||||
public static void CopyFrom<T>(this T me,
|
||||
T copyObj,
|
||||
IList<string> propNameList = null,
|
||||
bool isIncludeOrExclude = false)
|
||||
public static void CopyFrom<T>(this T me, T copyObj, IList<string> propNameList = null
|
||||
, bool isIncludeOrExclude = false)
|
||||
{
|
||||
foreach (var p in me.GetType().GetProperties()) {
|
||||
if (!p.CanWrite) continue;
|
||||
23
src/Extensions/JsonSerializerOptionsExtensions.cs
Normal file
23
src/Extensions/JsonSerializerOptionsExtensions.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace NSExt.Extensions;
|
||||
|
||||
public static class JsonSerializerOptionsExtensions
|
||||
{
|
||||
public static JsonSerializerOptions NewJsonSerializerOptions(this JsonSerializerOptions me)
|
||||
{
|
||||
return new JsonSerializerOptions {
|
||||
ReadCommentHandling = JsonCommentHandling.Skip
|
||||
, AllowTrailingCommas = true
|
||||
, DictionaryKeyPolicy = JsonNamingPolicy.CamelCase
|
||||
, PropertyNamingPolicy = JsonNamingPolicy.CamelCase
|
||||
, Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
|
||||
, NumberHandling
|
||||
= JsonNumberHandling.AllowReadingFromString |
|
||||
JsonNumberHandling.WriteAsString
|
||||
, PropertyNameCaseInsensitive = true
|
||||
};
|
||||
}
|
||||
}
|
||||
49
src/Extensions/LoggerExtensions.cs
Normal file
49
src/Extensions/LoggerExtensions.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
// ReSharper disable TemplateIsNotCompileTimeConstantProblem
|
||||
|
||||
namespace NSExt.Extensions;
|
||||
|
||||
public static class LoggerExtensions
|
||||
{
|
||||
private static string CallerInfoMessage(object message, string callerName, string callerFilePath
|
||||
, int callerLineNumber)
|
||||
{
|
||||
return
|
||||
$"{message} <s:{Environment.CurrentManagedThreadId}#{callerName}@{Path.GetFileName(callerFilePath)}:{callerLineNumber}>";
|
||||
}
|
||||
|
||||
public static void Debug(this ILogger me, object message, [CallerMemberName] string callerName = null
|
||||
, [CallerFilePath] string callerFilePath = null, [CallerLineNumber] int callerLineNumber = 0)
|
||||
{
|
||||
me.LogDebug(CallerInfoMessage(message, callerName, callerFilePath, callerLineNumber));
|
||||
}
|
||||
|
||||
|
||||
public static void Error(this ILogger me, object message, [CallerMemberName] string callerName = null
|
||||
, [CallerFilePath] string callerFilePath = null, [CallerLineNumber] int callerLineNumber = 0)
|
||||
{
|
||||
me.LogError(CallerInfoMessage(message, callerName, callerFilePath, callerLineNumber));
|
||||
}
|
||||
|
||||
public static void Fatal(this ILogger me, object message, Exception ex = null
|
||||
, [CallerMemberName] string callerName = null, [CallerFilePath] string callerFilePath = null
|
||||
, [CallerLineNumber] int callerLineNumber = 0)
|
||||
{
|
||||
if (ex is null)
|
||||
me.LogCritical(CallerInfoMessage(message, callerName, callerFilePath, callerLineNumber));
|
||||
else
|
||||
me.LogCritical(CallerInfoMessage(message, callerName, callerFilePath, callerLineNumber), ex);
|
||||
}
|
||||
|
||||
|
||||
public static void Info(this ILogger me, object message, [CallerMemberName] string callerName = null
|
||||
, [CallerFilePath] string callerFilePath = null, [CallerLineNumber] int callerLineNumber = 0)
|
||||
{
|
||||
me.LogInformation(CallerInfoMessage(message, callerName, callerFilePath, callerLineNumber));
|
||||
}
|
||||
|
||||
public static void Warn(this ILogger me, object message, [CallerMemberName] string callerName = null
|
||||
, [CallerFilePath] string callerFilePath = null, [CallerLineNumber] int callerLineNumber = 0)
|
||||
{
|
||||
me.LogWarning(CallerInfoMessage(message, callerName, callerFilePath, callerLineNumber));
|
||||
}
|
||||
}
|
||||
@@ -12,10 +12,7 @@ public static class ObjectExtensions
|
||||
/// <returns>json文本</returns>
|
||||
public static string Json(this object me, bool format = false)
|
||||
{
|
||||
return JsonSerializer.Serialize(me,
|
||||
new JsonSerializerOptions {
|
||||
WriteIndented = format,
|
||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
|
||||
});
|
||||
return JsonSerializer.Serialize(
|
||||
me, new JsonSerializerOptions { WriteIndented = format, PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,6 @@ public static class StreamExtensions
|
||||
|
||||
public static bool IsTextStream(this Stream me)
|
||||
{
|
||||
return me.FirstByteIndex(new byte[] {
|
||||
0x00,
|
||||
0xff
|
||||
}) < 0;
|
||||
return me.FirstByteIndex(new byte[] { 0x00, 0xff }) < 0;
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,8 @@ namespace NSExt.Extensions;
|
||||
|
||||
public static class StringExtensions
|
||||
{
|
||||
private static readonly JsonSerializerOptions _defaultJsonSerializerOptions =
|
||||
default(JsonSerializerOptions).NewJsonSerializerOptions();
|
||||
private static readonly JsonSerializerOptions _defaultJsonSerializerOptions
|
||||
= default(JsonSerializerOptions).NewJsonSerializerOptions();
|
||||
|
||||
/// <summary>
|
||||
/// MD5 hmac编码
|
||||
@@ -34,10 +34,8 @@ public static class StringExtensions
|
||||
/// <param name="cipherMode">指定要用于加密的块密码模式。</param>
|
||||
/// <param name="paddingMode">指定在消息数据块短于加密操作所需的完整字节数时要应用的填充类型。</param>
|
||||
/// <returns></returns>
|
||||
public static string Aes(this string me,
|
||||
string key,
|
||||
CipherMode cipherMode = CipherMode.ECB,
|
||||
PaddingMode paddingMode = PaddingMode.PKCS7)
|
||||
public static string Aes(this string me, string key, CipherMode cipherMode = CipherMode.ECB
|
||||
, PaddingMode paddingMode = PaddingMode.PKCS7)
|
||||
{
|
||||
using var aes = System.Security.Cryptography.Aes.Create();
|
||||
aes.Padding = PaddingMode.PKCS7;
|
||||
@@ -58,10 +56,8 @@ public static class StringExtensions
|
||||
/// <param name="cipherMode">指定要用于加密的块密码模式。</param>
|
||||
/// <param name="paddingMode">指定在消息数据块短于加密操作所需的完整字节数时要应用的填充类型。</param>
|
||||
/// <returns></returns>
|
||||
public static string AesDe(this string me,
|
||||
string key,
|
||||
CipherMode cipherMode = CipherMode.ECB,
|
||||
PaddingMode paddingMode = PaddingMode.PKCS7)
|
||||
public static string AesDe(this string me, string key, CipherMode cipherMode = CipherMode.ECB
|
||||
, PaddingMode paddingMode = PaddingMode.PKCS7)
|
||||
{
|
||||
using var aes = System.Security.Cryptography.Aes.Create();
|
||||
aes.Padding = PaddingMode.PKCS7;
|
||||
@@ -156,8 +152,8 @@ public static class StringExtensions
|
||||
public static DateTime DateTimeExactTry(this string me, string format, DateTime def)
|
||||
{
|
||||
return !System.DateTime.TryParseExact(me, format, CultureInfo.CurrentCulture, DateTimeStyles.None, out var ret)
|
||||
? def
|
||||
: ret;
|
||||
? def
|
||||
: ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>1.0.6</Version>
|
||||
<Version>1.0.7</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -1,16 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NSExt", "NSExt\NSExt.csproj", "{54814D1B-C587-4D90-A7BE-4BE1E170D5FC}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{54814D1B-C587-4D90-A7BE-4BE1E170D5FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{54814D1B-C587-4D90-A7BE-4BE1E170D5FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{54814D1B-C587-4D90-A7BE-4BE1E170D5FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{54814D1B-C587-4D90-A7BE-4BE1E170D5FC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,45 +0,0 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/CodeStyle/CSharpFileLayoutPatterns/Pattern/@EntryValue"><?xml version="1.0" encoding="utf-16"?>
|
||||
<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
|
||||
<TypePattern>
|
||||
<Entry>
|
||||
<Entry.SortBy>
|
||||
<Kind>
|
||||
<Kind.Order>
|
||||
<DeclarationKind>Interface</DeclarationKind>
|
||||
<DeclarationKind>Class</DeclarationKind>
|
||||
<DeclarationKind>Enum</DeclarationKind>
|
||||
<DeclarationKind>Struct</DeclarationKind>
|
||||
<DeclarationKind>Delegate</DeclarationKind>
|
||||
<DeclarationKind>Event</DeclarationKind>
|
||||
<DeclarationKind>Constant</DeclarationKind>
|
||||
<DeclarationKind>Field</DeclarationKind>
|
||||
<DeclarationKind>Property</DeclarationKind>
|
||||
<DeclarationKind>Constructor</DeclarationKind>
|
||||
<DeclarationKind>Destructor</DeclarationKind>
|
||||
<DeclarationKind>Indexer</DeclarationKind>
|
||||
<DeclarationKind>Method</DeclarationKind>
|
||||
</Kind.Order>
|
||||
</Kind>
|
||||
<Access>
|
||||
<Access.Order>
|
||||
<AccessModifier>Private</AccessModifier>
|
||||
<AccessModifier>PrivateProtected</AccessModifier>
|
||||
<AccessModifier>Protected</AccessModifier>
|
||||
<AccessModifier>ProtectedInternal</AccessModifier>
|
||||
<AccessModifier>Internal</AccessModifier>
|
||||
<AccessModifier>Public</AccessModifier>
|
||||
</Access.Order>
|
||||
</Access>
|
||||
<Name />
|
||||
</Entry.SortBy>
|
||||
</Entry>
|
||||
</TypePattern>
|
||||
</Patterns></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Constants/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateConstants/@EntryIndexedValue"><Policy Inspect="True" Prefix="_" Suffix="" Style="AA_BB" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue"><Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=StaticReadonly/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:Boolean x:Key="/Default/ReSpeller/ReSpellerEnabled/@EntryValue">False</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=TooWideLocalVariableScope/@EntryIndexedValue">HINT</s:String>
|
||||
</wpf:ResourceDictionary>
|
||||
@@ -1,21 +0,0 @@
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace NSExt.Extensions;
|
||||
|
||||
public static class JsonSerializerOptionsExtensions
|
||||
{
|
||||
public static JsonSerializerOptions NewJsonSerializerOptions(this JsonSerializerOptions me)
|
||||
{
|
||||
return new JsonSerializerOptions {
|
||||
ReadCommentHandling = JsonCommentHandling.Skip,
|
||||
AllowTrailingCommas = true,
|
||||
DictionaryKeyPolicy = JsonNamingPolicy.CamelCase,
|
||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
||||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
||||
NumberHandling = JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString,
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
// ReSharper disable TemplateIsNotCompileTimeConstantProblem
|
||||
|
||||
namespace NSExt.Extensions;
|
||||
|
||||
public static class LoggerExtensions
|
||||
{
|
||||
private static string CallerInfoMessage(object message,
|
||||
string callerName,
|
||||
string callerFilePath,
|
||||
int callerLineNumber)
|
||||
{
|
||||
return
|
||||
$"{message} <s:{Environment.CurrentManagedThreadId}#{callerName}@{Path.GetFileName(callerFilePath)}:{callerLineNumber}>";
|
||||
}
|
||||
|
||||
public static void Debug(this ILogger me,
|
||||
object message,
|
||||
[CallerMemberName] string callerName = null,
|
||||
[CallerFilePath] string callerFilePath = null,
|
||||
[CallerLineNumber] int callerLineNumber = 0)
|
||||
{
|
||||
me.LogDebug(CallerInfoMessage(message, callerName, callerFilePath, callerLineNumber));
|
||||
}
|
||||
|
||||
|
||||
public static void Error(this ILogger me,
|
||||
object message,
|
||||
[CallerMemberName] string callerName = null,
|
||||
[CallerFilePath] string callerFilePath = null,
|
||||
[CallerLineNumber] int callerLineNumber = 0)
|
||||
{
|
||||
me.LogError(CallerInfoMessage(message, callerName, callerFilePath, callerLineNumber));
|
||||
}
|
||||
|
||||
public static void Fatal(this ILogger me,
|
||||
object message,
|
||||
Exception ex = null,
|
||||
[CallerMemberName] string callerName = null,
|
||||
[CallerFilePath] string callerFilePath = null,
|
||||
[CallerLineNumber] int callerLineNumber = 0)
|
||||
{
|
||||
if (ex is null)
|
||||
me.LogCritical(CallerInfoMessage(message, callerName, callerFilePath, callerLineNumber));
|
||||
else
|
||||
me.LogCritical(CallerInfoMessage(message, callerName, callerFilePath, callerLineNumber), ex);
|
||||
}
|
||||
|
||||
|
||||
public static void Info(this ILogger me,
|
||||
object message,
|
||||
[CallerMemberName] string callerName = null,
|
||||
[CallerFilePath] string callerFilePath = null,
|
||||
[CallerLineNumber] int callerLineNumber = 0)
|
||||
{
|
||||
me.LogInformation(CallerInfoMessage(message, callerName, callerFilePath, callerLineNumber));
|
||||
}
|
||||
|
||||
public static void Warn(this ILogger me,
|
||||
object message,
|
||||
[CallerMemberName] string callerName = null,
|
||||
[CallerFilePath] string callerFilePath = null,
|
||||
[CallerLineNumber] int callerLineNumber = 0)
|
||||
{
|
||||
me.LogWarning(CallerInfoMessage(message, callerName, callerFilePath, callerLineNumber));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user