{"id":24857291,"url":"https://github.com/swellshinider/leallogger","last_synced_at":"2026-06-13T01:31:30.616Z","repository":{"id":271783902,"uuid":"914462593","full_name":"Swellshinider/LealLogger","owner":"Swellshinider","description":"LealLogger is a high-performance, extensible, and lightweight logging library for .NET applications.","archived":false,"fork":false,"pushed_at":"2025-11-13T13:54:44.000Z","size":759,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-03T02:56:23.203Z","etag":null,"topics":["dotnet","logger","logging"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Swellshinider.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-09T16:38:19.000Z","updated_at":"2025-11-13T13:53:15.000Z","dependencies_parsed_at":"2025-03-26T15:51:48.515Z","dependency_job_id":null,"html_url":"https://github.com/Swellshinider/LealLogger","commit_stats":null,"previous_names":["swellshinider/leallogger"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Swellshinider/LealLogger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swellshinider%2FLealLogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swellshinider%2FLealLogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swellshinider%2FLealLogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swellshinider%2FLealLogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Swellshinider","download_url":"https://codeload.github.com/Swellshinider/LealLogger/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swellshinider%2FLealLogger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34269363,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotnet","logger","logging"],"created_at":"2025-01-31T17:17:00.713Z","updated_at":"2026-06-13T01:31:30.580Z","avatar_url":"https://github.com/Swellshinider.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# LealLogger\n\n[![NuGet](https://img.shields.io/nuget/v/LealLogger.svg)](https://www.nuget.org/packages/LealLogger/)\n\n\u003c/div\u003e\n\n**LealLogger** is a high-performance, extensible, and lightweight logging library for .NET applications. It supports multiple logging outputs (e.g., Console, File) and provides flexibility through a powerful builder pattern. Whether you're developing a small project or a high-load enterprise application, LealLogger adapts to your needs with ease.\n\n---\n\n## Table of Contents\n\n- [LealLogger](#leallogger)\n  - [Table of Contents](#table-of-contents)\n  - [Getting Started](#getting-started)\n    - [Installation](#installation)\n    - [Usage](#usage)\n      - [1. Basic Setup](#1-basic-setup)\n      - [2. Adding File Logging](#2-adding-file-logging)\n      - [3. Custom Logger](#3-custom-logger)\n  - [API Reference](#api-reference)\n    - [LoggerBuilder](#loggerbuilder)\n    - [Log Levels](#log-levels)\n    - [LogHandler](#loghandler)\n  - [Customization Guide](#customization-guide)\n    - [Custom Log Handlers](#custom-log-handlers)\n  - [Contribution](#contribution)\n    - [How to Contribute](#how-to-contribute)\n  - [License](#license)\n\n## Getting Started\n\n### Installation\n\nYou can install LealLogger via terminal:\n\n```bash\ndotnet add package LealLogger\n```\n\n### Usage\n\nFor a practical example check out [Sample project](./LealLogger.Sample/Program.cs)\n\n#### 1. Basic Setup\n\n```csharp\nusing LealLogger.Factory;\n\nusing var logger = new LoggerBuilder()\n    .AddConsoleHandler() // This adds a console handler to the logger, witch means that every time \n                        // you log something it will be automatically printed into the console\n    .SetMinimumLogLevel(LogLevel.INFO)\n    .Build();\n\n\nlogger.Debug(\"Application started.\"); // This won't be logged, because you setted the minimum LevelLog to INFO\nlogger.Info(\"Application started.\");\nlogger.Warn(\"Low disk space detected.\");\nlogger.Error(\"Unhandled exception occurred.\", new Exception(\"Example exception\"));\n```\n\n#### 2. Adding File Logging\n\n```csharp\nvar logger = new LoggerBuilder()\n    .AddConsoleHandler()\n    .AddFileHandler(\"logs/app.log\")\n    .SetQueueCapacity(5000)\n    .Build();\n\nlogger.Info(\"Logging to both console and file.\");\n```\n\n#### 3. Custom Logger\n\nDefine a custom logger class by inheriting from `BaseLogger`:\n\n```csharp\npublic sealed class MyCustomLogger : BaseLogger\n{\n    public MyCustomLogger(LogLevel logLevel, int queueCapacity, ImmutableArray\u003cLogHandler\u003e handlers)\n        : base(logLevel, queueCapacity, handlers)\n    {\n    }\n\n    public override void Debug(string message, Exception? ex = null) { /* Custom behavior */ }\n    public override void Info(string message, Exception? ex = null) { /* Custom behavior */ }\n    public override void Warn(string message, Exception? ex = null) { /* Custom behavior */ }\n    public override void Error(string message, Exception? ex = null) { /* Custom behavior */ }\n    public override void Fatal(string message, Exception? ex = null) { /* Custom behavior */ }\n    public override void Dispose() { /* Cleanup resources */ }\n}\n```\n\nUse the `LoggerBuilder` to instantiate it:\n\n```csharp\nvar customLogger = new LoggerBuilder()\n    .AddConsoleHandler()\n    .Build\u003cMyCustomLogger\u003e(); // \u003c--\n\ncustomLogger.Info(\"Custom logger in action!\");\n```\n\n---\n\n## API Reference\n\n### LoggerBuilder\n\nThe `LoggerBuilder` class simplifies logger configuration and instantiation.\n\n- **`AddConsoleHandler()`**: Adds a console log handler.\n- **`AddFileHandler(string filePath)`**: Adds a file log handler.\n- **`AddHandler\u003cT\u003e(T handler)`**: Adds a custom log handler.\n- **`SetMinimumLogLevel(LogLevel logLevel)`**: Sets the minimum log level for logs to be processed.\n- **`SetQueueCapacity(int queueCapacity)`**: Sets the queue capacity for buffering logs.\n- **`Build()`**: Creates a default `Logger`.\n- **`Build\u003cT\u003e()`**: Creates a custom logger of type `T`.\n\n### Log Levels\n\n- `DEBUG`\n- `INFO`\n- `WARN`\n- `ERROR`\n- `FATAL`\n\n### LogHandler\n\nImplement `LogHandler` to create custom log output mechanisms. For example:\n\n```csharp\npublic sealed class MyCustomHandler : LogHandler\n{\n    public override void HandleLog(Log logEntry)\n    {\n        // Custom handling logic\n    }\n\n    public override void Dispose()\n    {\n        // Cleanup resources\n    }\n}\n```\n\n---\n\n## Customization Guide\n\n### Custom Log Handlers\n\nCreate your own log handler by inheriting from `LogHandler`. Example:\n\n```csharp\npublic sealed class DatabaseLogHandler : LogHandler\n{\n    public override void HandleLog(Log logEntry)\n    {\n        // Insert log entry into a database\n    }\n\n    public override void Dispose()\n    {\n        // Close database connections\n    }\n}\n```\n\n```csharp\nvar logger = new LoggerBuilder()\n    .AddConsoleHandler()\n    .AddFileHandler(\"logs/app.log\")\n    .AddHandler(new DatabaseLogHandler())\n    .SetQueueCapacity(5000)\n    .Build();\n\nlogger.Info(\"This log will be printed into the console, saved into the file and saved into the database\");\n```\n---\n\n## Contribution\n\nContributions are welcome! If you have ideas to improve LealLogger, feel free to open an issue or fork the repository.\n\n### How to Contribute\n\n- Fork the repository.\n- Create a new branch for your feature or bugfix.\n- Please, test your changes before committing.\n- Submit a pull request with a detailed explanation of your changes.\n- :)\n\n## License\n\nThis project is licensed under the MIT License. See the LICENSE file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswellshinider%2Fleallogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswellshinider%2Fleallogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswellshinider%2Fleallogger/lists"}