| File | Date | Author | Commit |
|---|---|---|---|
| .github | 2025-05-24 |
|
[139a70] Update dotnet-desktop.yml |
| ALog | 2025-06-17 |
|
[c7b78c] Added scope stackable context data logging. Add... |
| DemoApp | 2025-06-17 |
|
[c7b78c] Added scope stackable context data logging. Add... |
| .gitattributes | 2025-05-24 |
|
[3b0664] Add .gitattributes, .gitignore, and README.md. |
| .gitignore | 2025-05-24 |
|
[3b0664] Add .gitattributes, .gitignore, and README.md. |
| ALog.sln | 2025-05-24 |
|
[2f2081] Added Demoproject |
| README.md | 2025-06-17 |
|
[65ba83] Update README.md |
ALog is a powerful and extensible logging framework built for .NET 8+.
It is designed to be simple to use, highly configurable, and ready for modern development across platforms including Windows, Linux, and iOS.
Log.Write(...), Log.WriteAsync(...)BeginScope(...))using ALog; gives access to everythingALog is currently under development. You can use it via project reference:
git clone https://github.com/yourusername/ALog.git
Reference ALog.csproj in your .NET 8+ project.
using ALog;
var config = new LoggerConfig()
.AddWriter(new ConsoleLogWriter(useColors: true, formatter: new PlainTextFormatter("HH:mm:ss")))
.AddWriter(new FileLogWriter("logs/app.log", new JsonFormatter(pretty: true), maxFileSizeInBytes: 1_048_576)) // 1 MB
.SetMinimumLevel(LogLevel.Debug);
Log.Init(config);
Log.Write("Application started");
using (Log.BeginScope("userId", 42))
{
using (Log.BeginScope("feature", "Login"))
{
Log.Write("User successfully authenticated");
Log.Write(new Exception("Test failure"), "Something went wrong", LogLevel.Error);
}
}
await Log.WriteAsync("Async log message");
You can use built-in IPlatformHelper implementations to resolve safe, writeable log paths:
using ALog.Platform.Windows;
var logPath = new WindowsPlatformHelper().ResolveLogFilePath("logs/app.log");
using ALog.Platform.Linux;
var logPath = new LinuxPlatformHelper().ResolveLogFilePath("logs/app.log");
using ALog.Platform.iOS;
var logPath = new IOSPlatformHelper().ResolveLogFilePath("logs/app.log");
You control the log location – ALog does not enforce platform helpers. They are optional and recommended for mobile or portable environments.
| Writer | Description |
|---|---|
ConsoleLogWriter |
Outputs to console with optional color and formatting |
FileLogWriter |
Outputs to file with optional rolling and formatter support |
| Formatter | Description |
|---|---|
PlainTextFormatter |
Developer-friendly, single-line format (customizable time) |
JsonFormatter |
Structured JSON output, ideal for logs ingestion tools |
Scoped logging adds temporary key-value pairs that are automatically removed when their scope ends:
using (Log.BeginScope("sessionId", "abc123"))
{
Log.Write("User clicked 'Buy'");
}
// sessionId is no longer attached here
Works automatically with supported formatters like JSON or plain text.
using Log.BeginScope(...))Contributions welcome! Fork the repository and submit a PR.
For ideas like new formatters or writers, feel free to open a discussion first.
MIT © Artur Zubert / Chookees
Built and maintained by Artur Zubert / Chookees