Add WmsLite monorepo with JWT auth, tenant context, and project READMEs.
Implement API security baseline (sys_user, JWT, audit fields, transactions, unique constraints) and Web real login with 401 handling. Document setup and development workflows in root, WmsLite.Api, and WmsLite.Web README files. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
commit
fa1b286463
241 files changed
+31188
No files matched your search
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WmsLite.Api.Infrastructure.HttpLogging;
|
||||
|
||||
internal static class HttpAccessLogFormatter
|
||||
{
|
||||
private const string Bar = "────────────────────────────────────────";
|
||||
private const string Thick = "════════════════════════════════════════";
|
||||
|
||||
public static string Build(
|
||||
string method,
|
||||
string? path,
|
||||
int statusCode,
|
||||
string requestContent,
|
||||
string responseContent,
|
||||
IReadOnlyList<string> sqlStatements)
|
||||
{
|
||||
var sb = new StringBuilder(512 + requestContent.Length + responseContent.Length);
|
||||
sb.AppendLine(Thick);
|
||||
sb.AppendLine(" HTTP ACCESS");
|
||||
sb.AppendLine(Thick);
|
||||
sb.Append("Time : ").AppendLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
|
||||
sb.Append("Method : ").AppendLine(method);
|
||||
sb.Append("Path : ").AppendLine(path ?? string.Empty);
|
||||
sb.Append("Status : ").AppendLine(statusCode.ToString());
|
||||
sb.AppendLine(Bar);
|
||||
sb.AppendLine("Request");
|
||||
sb.AppendLine(Bar);
|
||||
sb.AppendLine(string.IsNullOrEmpty(requestContent) ? "(empty)" : requestContent);
|
||||
sb.AppendLine();
|
||||
sb.AppendLine(Bar);
|
||||
sb.AppendLine("Response");
|
||||
sb.AppendLine(Bar);
|
||||
sb.AppendLine(string.IsNullOrEmpty(responseContent) ? "(empty)" : responseContent);
|
||||
sb.AppendLine();
|
||||
sb.AppendLine(Bar);
|
||||
sb.Append("SQL (").Append(sqlStatements.Count).AppendLine(")");
|
||||
sb.AppendLine(Bar);
|
||||
if (sqlStatements.Count == 0)
|
||||
{
|
||||
sb.AppendLine("(no database commands)");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (var i = 0; i < sqlStatements.Count; i++)
|
||||
{
|
||||
sb.Append('[').Append(i + 1).AppendLine("]");
|
||||
sb.AppendLine(sqlStatements[i]);
|
||||
if (i < sqlStatements.Count - 1)
|
||||
{
|
||||
sb.AppendLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sb.AppendLine(Thick);
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user