AyCode.Core/AyCode.Core/Loggers
Loretta 541cebbed8 Update README links to use code-style paths for docs
Replaced Markdown links with plain code-style paths in all README.md files for consistency. Updated references to logging, SignalR, and dynamic method dispatch documentation. Clarified some documentation paths and improved consistency in context/architecture sections. No code changes—documentation only.
2026-03-30 08:01:05 +02:00
..
AcConsoleLogWriter.cs improvements 2025-10-21 15:15:15 +02:00
AcLogWriterBase.cs Logger improvements 2025-10-23 06:35:32 +02:00
AcLoggerAdapter.cs Integrate AcLogger with Microsoft.Extensions.Logging 2026-01-09 11:12:35 +01:00
AcLoggerBase.cs Add Toon serializer: LLM-optimized format & rich metadata 2026-01-10 20:13:54 +01:00
AcTextLogWriterBase.cs fix 2024-05-19 08:05:16 +02:00
IAcLogItemClient.cs refactroing, improvements, fixes, etc... 2024-05-18 05:12:23 +02:00
IAcLogWriterBase.cs Implement ConditionalLog to Logger 2024-05-19 13:17:13 +02:00
IAcLogWriterClientBase.cs AcSignalRClient; AcBrowserLogWriter... 2025-09-01 16:19:01 +02:00
IAcLoggerBase.cs Integrate AcLogger with Microsoft.Extensions.Logging 2026-01-09 11:12:35 +01:00
LogLevel.cs Add Logger 2024-05-14 13:04:01 +02:00
README.md Update README links to use code-style paths for docs 2026-03-30 08:01:05 +02:00

README.md

Loggers

Custom logging framework with multi-writer fan-out and Microsoft.Extensions.Logging integration. This directory contains the core logger and writer abstractions — the defining layer for the logging system.

For full architecture, configuration, all writers, and remote logging flow see docs/LOGGING.md.

Architecture

IAcLoggerBase (: IAcLogWriterBase, ILogger)
  └─ AcLoggerBase (abstract, multi-writer fan-out, ILogger bridge)
       └─ [concrete loggers per consuming project]

IAcLogWriterBase
  └─ AcLogWriterBase (abstract, per-writer config from appsettings)
       ├─ AcTextLogWriterBase (abstract, text formatting)
       │    └─ AcConsoleLogWriter (colored console output)
       └─ [AcLogItemWriterBase<T> in AyCode.Entities — structured writers]

Two-level filtering: Logger has a global LogLevel gate; each writer has its own LogLevel. Both must pass for a log entry to be written. See docs/LOGGING.md → Design Overview.

Key Files

Logger Core

  • IAcLoggerBase.cs — Unified interface combining IAcLogWriterBase + ILogger. Exposes GetWriters and Writer<T>().
  • AcLoggerBase.cs — Abstract logger implementing ILogger. Manages List<IAcLogWriterBase>. Reads config from appsettings.json (AyCode:Logger:{AppType, LogLevel, LogWriters[]}). Maps MS LogLevel to AC LogLevel. Fan-out dispatch to all writers. [Conditional("DEBUG")] variants for all methods.
  • AcLoggerAdapter.csAcLoggerProvider<TLogger> implementing ILoggerProvider with ConcurrentDictionary<string, TLogger> per-category cache. Extension methods: AddAcLogger<T>(), UseOnlyAcLogger<T>().

Writers

  • IAcLogWriterBase.cs — Writer contract: Detail(), Debug(), Info(), Warning(), Suggest(), Error(), plus Write() overloads and Write(IAcLogItemClient).
  • IAcLogWriterClientBase.cs — Marker interface for client-side writers (no additional members).
  • AcLogWriterBase.cs — Abstract base. Own LogLevel loaded from appsettings by matching AssemblyQualifiedName. Named methods delegate to terminal Write(AppType, LogLevel, text, caller, category, errorType, exMessage).
  • AcTextLogWriterBase.cs — Abstract text formatter. Format: [HH:mm:ss.fff] [AppType[0]] [Level] [Category->Method] [ThreadId] Text [Error]. Subclasses implement WriteText(string, LogLevel).
  • AcConsoleLogWriter.cs — Colored console writer. Thread-safe via static lock. Colors: Gray=≤Trace, White=DebugInfo, Cyan=Suggest, Yellow=Warning, Red=≥Error.

Supporting

  • IAcLogItemClient.cs — Structured log item DTO interface for remote transmission (TimeStampUtc, AppType, LogLevel, ThreadId, CategoryName, CallerName, Text, Exception, ErrorType).
  • LogLevel.cs — Byte enum: Detail(0), Trace(5), Debug(10), Info(15), Suggest(17), Warning(20), Error(25), Disabled(255). ⚠️ Values synchronized with database LogLevel table — do NOT renumber.