Initial import from local backup (Documents-Playground/pakerpale)

This commit is contained in:
jeonghwa
2026-07-03 05:27:03 +09:00
commit 7543d94a37
38 changed files with 21641 additions and 0 deletions

View File

@@ -0,0 +1,100 @@
using System;
using Microsoft.Extensions.Logging;
namespace Auth.api.Internal
{
public static class LoggerExtensions
{
#region snippet1
private static readonly Action<ILogger, string, Exception> _info;
#endregion
#region snippet2
private static readonly Action<ILogger, string, Exception> _quoteAdded;
#endregion
#region snippet3
private static readonly Action<ILogger, string, int, Exception> _quoteDeleted;
private static readonly Action<ILogger, int, Exception> _quoteDeleteFailed;
#endregion
#region snippet4
private static Func<ILogger, int, IDisposable> _allQuotesDeletedScope;
#endregion
static LoggerExtensions()
{
#region snippet5
_info = LoggerMessage.Define<string>(
LogLevel.Information,
new EventId(1, nameof(info)),
"[API] Request {requested} started.");
#endregion
#region snippet6
_quoteAdded = LoggerMessage.Define<string>(
LogLevel.Information,
new EventId(2, nameof(QuoteAdded)),
"Quote added (Quote = '{Quote}')");
#endregion
// Reserve EventId: 3 (QuoteModified)
#region snippet7
_quoteDeleted = LoggerMessage.Define<string, int>(
LogLevel.Information,
new EventId(4, nameof(QuoteDeleted)),
"Quote deleted (Quote = '{Quote}' Id = {Id})");
_quoteDeleteFailed = LoggerMessage.Define<int>(
LogLevel.Error,
new EventId(5, nameof(QuoteDeleteFailed)),
"Quote delete failed (Id = {Id})");
#endregion
#region snippet8
_allQuotesDeletedScope =
LoggerMessage.DefineScope<int>("All quotes deleted (Count = {Count})");
#endregion
}
#region snippet9
public static void info(this ILogger logger, string message)
{
_info(logger, message, null);
}
#endregion
#region snippet10
public static void QuoteAdded(this ILogger logger, string quote)
{
_quoteAdded(logger, quote, null);
}
#endregion
public static void QuoteModified(this ILogger logger, string id, string priorQuote, string newQuote)
{
// Reserve for future feature
}
#region snippet11
public static void QuoteDeleted(this ILogger logger, string quote, int id)
{
_quoteDeleted(logger, quote, id, null);
}
public static void QuoteDeleteFailed(this ILogger logger, int id, Exception ex)
{
_quoteDeleteFailed(logger, id, ex);
}
#endregion
#region snippet12
public static IDisposable AllQuotesDeletedScope(
this ILogger logger, int count)
{
return _allQuotesDeletedScope(logger, count);
}
#endregion
}
}