- Restructured documentation: added `docs/README.md` to each sub-project, moved LOGGING and SIGNALR docs into dedicated subfolders with their own `README.md`. - Updated all cross-references to use new topic folder paths and canonical AyCode.Core doc locations. - Updated `.csproj` files to auto-include all Markdown docs and project-level `README.md` files. - Removed obsolete single-file docs, replaced with structured content in topic folders. - Enforced AI Agent Protocol: session setup, output prefix, no-re-read, and mandatory `docs-check` skill after code changes. - Added domain-critical reminders and navigation guidance to relevant `README.md` files. |
||
|---|---|---|
| .. | ||
| README.md | ||
README.md
NopLogWriter — Logging Bridge
Part of
Mango.Nop.Services. SeeMango.Nop.Services/README.mdfor project overview. For AyCode base logging types (AcLogItemWriterBase,AcLogItem, log levels) seeAyCode.Core/AyCode.Core/docs/LOGGING/README.md.
Overview
Bridges AyCode logging to nopCommerce's Nop.Core.Domain.Logging.Log table via direct DB insert.
NopLogWriter
| Feature | Detail |
|---|---|
| Inherits | AcLogItemWriterBase<AcLogItem> (AyCode.Core) |
| Log level mapping | AyCode Detail/Trace/Debug/Info -> nopCommerce Information; Suggest/Warning -> Warning; Error -> Error |
| Direct DB insert | Uses NopLoggerMsSqlNopDataProvider with TransactionScope(Suppress) to avoid transaction conflicts |
Constructor: (INopLoggerMsSqlNopDataProvider, CommonSettings, CustomerSettings, IWebHelper, Nop.Services.Logging.ILogger, string? categoryName)
NopLoggerMsSqlNopDataProvider
Extends MsSqlNopDataProvider. Provides isolated DB access for log writes.
| Method | Purpose |
|---|---|
InsertLogItem<T>() |
Sync insert with own TransactionScope(Suppress, ReadUncommitted) |
InsertLogItemAsync<T>() |
Async insert with own TransactionScope(Suppress, ReadUncommitted) |
The TransactionScope(Suppress) is critical — without it, log writes would participate in the caller's transaction, causing nesting conflicts and potential deadlocks.
Integration Point
Application code -> Mango.Nop.Core.Loggers.ILogger (extends IAcLoggerBase)
-> Logger<TCategory> (extends AcLoggerBase, delegates to IAcLogWriterBase[])
-> NopLogWriter -> Nop Log table (direct SQL insert)
-> [Other AyCode log writers: console, file, SignalR, etc.]
Exception: MgBackgroundServiceBase uses Nop.Services.Logging.ILogger directly (nopCommerce logger), not the Mango wrapper.