Path: redb-route/redb.Route/Fluent/LogDsl.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route/Fluent/LogDsl.cs ---- using System.Text; namespace redb.Route; /// /// Fluent entry point for Log producer endpoints. /// /// .To(LogDsl.Info("myLogger").ShowHeaders().ShowBody()) /// .To(LogDsl.Debug("trace")) /// /// public static class LogDsl { public static LogBuilder Trace(string name) => new(name, "Trace"); public static LogBuilder Debug(string name) => new(name, "Debug"); public static LogBuilder Info(string name) => new(name, "Information"); public static LogBuilder Warn(string name) => new(name, "Warning"); public static LogBuilder Error(string name) => new(name, "Error"); } /// Fluent builder for Log endpoint URIs. public sealed class LogBuilder { private readonly string _name; private readonly string _level; private bool _showHeaders; private bool _showBody; internal LogBuilder(string name, string level) { ArgumentException.ThrowIfNullOrWhiteSpace(name); _name = name; _level = level; } /// Include message headers in log output. public LogBuilder ShowHeaders() { _showHeaders = true; return this; } /// Include message body in log output. public LogBuilder ShowBody() { _showBody = true; return this; } public string Build() { var sb = new StringBuilder(); sb.Append("log:"); sb.Append(_name); var sep = '?'; void Append(string key, string v) { sb.Append(sep); sb.Append(key); sb.Append('='); sb.Append(v); sep = '&'; } void AppendBool(string key, bool v) { if (v) Append(key, "true"); } Append("level", _level); AppendBool("showHeaders", _showHeaders); AppendBool("showBody", _showBody); return sb.ToString(); } public static implicit operator string(LogBuilder b) => b.Build(); public override string ToString() => Build(); }