Appearance
Carrot.Data.Scaffold.Compilers.Sinks.Logging
net
Logging sink for the scaffold compiler pipeline. Reports module execution, renderer output counts, and optionally dumps full generated file content.
Installation
xml
<ProjectReference Include="..\Carrot.Data.Scaffold.Compilers.Sinks.Logging\Carrot.Data.Scaffold.Compilers.Sinks.Logging.csproj" />Architecture
How It Works
ScaffoldCompilerSinkLog extends ScaffoldCompilerSinkMeta<ScaffoldCompilerSinkLogOptions>, making it both a regular sink and a metadata sink. This means it participates in two phases of the pipeline:
Metadata phase (per-module/per-renderer):
WriteMeta(module)- logs[Scaffold.ModuleName]whenReportFileCreationis enabledWriteMeta(module, renderer, outputs)- logs[Scaffold.ModuleName.RendererName] Generated N files.with per-file path and line count. Suppresses output for renderers with zero files unlessReportZeroFilesis true.
Sink phase (full bundle):
Write(bundle)- whenReportFinalFilesis enabled, dumps the full content of every generated file with*-delimited headers showing file name, extension, and folder.
Options
| Option | Default | Description |
|---|---|---|
Enabled | true | Master switch for the sink |
ReportFileCreation | false | Log module/renderer names and per-file paths during metadata phase |
ReportFinalFiles | false | Dump full file content during the sink phase |
ReportZeroFiles | true | Include renderers that produced zero files in metadata output |
Dependencies
| Dependency | Kind |
|---|---|
Carrot.Data.Scaffold.Compilers | project (compiler pipeline framework) |
Build
bash
dotnet buildUsage Guide
Logging sink that reports scaffold compilation progress - module names, renderer output counts, file paths, and optionally full file content.
Getting Started
csharp
using Carrot.Data.Scaffold;
using Carrot.Data.Scaffold.Domain;
scaffold.Compiler(compiler =>
{
compiler
.AddModule<MyGraphRoot, MyModule>()
.SinkToLog()
.SinkToFileSystem()
.Build();
});Common Patterns
1. Default (enabled, quiet)
csharp
compiler.SinkToLog();
// Enabled by default but ReportFileCreation and ReportFinalFiles are off,
// so only zero-file renderers are noted.2. Report file creation progress
csharp
compiler.SinkToLog(options =>
{
options.ReportFileCreation = true;
});
// Output:
// [Scaffold.Domain]
// [Scaffold.Domain.EntityRenderer] Generated 12 files.
// src/Domain/Entities/User.cs (45 lines)
// src/Domain/Entities/Order.cs (62 lines)3. Dump full generated content
csharp
compiler.SinkToLog(options =>
{
options.ReportFinalFiles = true;
});
// Dumps every file's content with header separators - useful for debugging renderers.4. Suppress zero-file renderers
csharp
compiler.SinkToLog(options =>
{
options.ReportFileCreation = true;
options.ReportZeroFiles = false; // skip renderers that produced nothing
});5. Manual registration (without extension)
csharp
compiler.SinkTo<ScaffoldCompilerSinkLog, ScaffoldCompilerSinkLogOptions>(options =>
{
options.Enabled = true;
options.ReportFileCreation = true;
});Tips / Gotchas
- Register before FileSystem sink - sinks execute in registration order. If you want to see log output before files are written, register the log sink first.
- Metadata callbacks happen during the module loop -
WriteMetais called per-module and per-renderer as they execute, giving real-time progress. TheWritemethod runs later during the sink phase with the full bundle. - ReportFinalFiles can be very verbose - it dumps the full content of every generated file. Best used for debugging a specific module, not in production scaffold runs.
- Enabled by default but quiet - with default options, the sink is enabled but
ReportFileCreationandReportFinalFilesare bothfalse. The only visible behavior is suppressing/showing zero-file renderers.