Albatross.CommandLine.Defaults
9.0.0-rc.266
Prefix Reserved
dotnet add package Albatross.CommandLine.Defaults --version 9.0.0-rc.266
NuGet\Install-Package Albatross.CommandLine.Defaults -Version 9.0.0-rc.266
<PackageReference Include="Albatross.CommandLine.Defaults" Version="9.0.0-rc.266" />
<PackageVersion Include="Albatross.CommandLine.Defaults" Version="9.0.0-rc.266" />
<PackageReference Include="Albatross.CommandLine.Defaults" />
paket add Albatross.CommandLine.Defaults --version 9.0.0-rc.266
#r "nuget: Albatross.CommandLine.Defaults, 9.0.0-rc.266"
#:package Albatross.CommandLine.Defaults@9.0.0-rc.266
#addin nuget:?package=Albatross.CommandLine.Defaults&version=9.0.0-rc.266&prerelease
#tool nuget:?package=Albatross.CommandLine.Defaults&version=9.0.0-rc.266&prerelease
Albatross.CommandLine.Defaults
Adds opinionated, ready-to-use configuration and logging to an Albatross.CommandLine application through a single .WithDefaults() call. Logging is written to a file (never the console), so a command's standard output and standard error stay clean for its own output — a contract that scripts, pipes, and tooling can rely on. This package is optional; if you need a different logging framework or dependency versions, wire those up yourself against the core library.
Key Features
- File-based logging by default - Serilog writes to a daily-rolling file under
IApplicationPath.LogRoot; no console sink is attached, sostdout/stderrbelong entirely to the command's output. - Config-driven verbosity - the log level, per-namespace overrides, extra sinks, and enrichers are read from a
Serilogsection viaReadFrom.Configuration, so verbosity is editable at deploy time without recompiling. - Sensible zero-config baseline - with no configuration at all, logging still works:
Informationlevel,FromLogContext+ThreadIdenrichment, and the file sink are set in code; aSerilogsection only layers on top. - JSON configuration - loads
appsettings.json(plusappsettings.{DOTNET_ENVIRONMENT}.json) and environment variables, and registersProgramSetting,EnvironmentSetting, andIHostEnvironment. - Composable - use
.WithDefaults()for both, or.WithConfig()/.WithSerilog()individually.
Quick Start
Install alongside Albatross.CommandLine:
<PackageReference Include="Albatross.CommandLine.Defaults" Version="..." />
WithSerilog() writes to IApplicationPath.LogRoot, so register an IApplicationPath and pass its ConfigRoot to WithDefaults() (that is where appsettings.json is read from):
using Albatross.CommandLine;
using Albatross.CommandLine.Defaults;
using Albatross.Config;
using Microsoft.Extensions.DependencyInjection;
using MyApp.AutoGenerated; // generated RegisterCommands()/AddCommands() live in <RootNamespace>.AutoGenerated
static async Task<int> Main(string[] args) {
var appPath = new ApplicationPath(false, ["myapp"], "myapp", null, args);
appPath.Init(); // creates ConfigRoot / LogRoot / DataRoot
await using var host = new CommandHost("My CLI App")
.RegisterServices((result, services) => {
services.AddSingleton<IApplicationPath>(appPath);
services.RegisterCommands();
})
.AddCommands()
.Parse(args)
.WithDefaults(appPath.ConfigRoot) // config + file logging
.Build();
return await host.InvokeAsync();
}
To change verbosity, drop a Serilog section into appsettings.json (in ConfigRoot) — no rebuild required:
{
"Serilog": {
"MinimumLevel": {
"Default": "Debug",
"Override": { "Microsoft": "Warning", "System": "Warning" }
}
}
}
Dependencies
- Albatross.Config (8.0.0-rc.51): application paths (
IApplicationPath), configuration, and environment handling. - Serilog (4.3.0), Serilog.Extensions.Hosting (8.0.0), Serilog.Settings.Configuration (8.0.4), Serilog.Sinks.File (6.0.0), Serilog.Enrichers.Thread (4.0.0): file logging configured directly against Serilog.
- Microsoft.Extensions.Hosting (8.0.1), Microsoft.Extensions.DependencyInjection (8.0.1): host builder and service container.
Prerequisites
- .NET 8 (
net8.0) or newer. - Registering an
IApplicationPathbefore the host is built is optional — it controls where logs are written. If none is registered,WithSerilog()falls back to aDefaultApplicationPaththat logs to alogfolder under the application base directory.
Documentation
Links
- Defaults Library — configuration and logging setup in depth.
- Logging & Verbosity — the v9 file-based logging model and how to control log levels.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Albatross.CommandLine (>= 9.0.0-rc.266)
- Albatross.Config (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.9)
- Microsoft.Extensions.Hosting (>= 10.0.9)
- Serilog (>= 4.4.0)
- Serilog.Enrichers.Thread (>= 4.0.0)
- Serilog.Extensions.Hosting (>= 10.0.0)
- Serilog.Settings.Configuration (>= 10.0.1)
- Serilog.Sinks.File (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 9.0.0-rc.266 | 42 | 7/11/2026 |
| 9.0.0-rc.261 | 44 | 7/10/2026 |
| 8.0.14 | 53 | 5/30/2026 |
| 8.0.12 | 51 | 5/8/2026 |
| 8.0.11 | 44 | 5/1/2026 |
| 8.0.8 | 77 | 2/23/2026 |
| 8.0.7 | 131 | 1/26/2026 |
| 8.0.6 | 74 | 1/23/2026 |
| 8.0.5 | 69 | 1/22/2026 |
| 8.0.4 | 70 | 1/21/2026 |
| 8.0.3 | 76 | 1/16/2026 |
| 8.0.2 | 77 | 1/11/2026 |
| 8.0.1 | 234 | 1/9/2026 |