{"id":44708341,"url":"https://github.com/ikelaiah/simplelog-fp","last_synced_at":"2026-02-15T11:13:57.582Z","repository":{"id":302441893,"uuid":"1012439721","full_name":"ikelaiah/simplelog-fp","owner":"ikelaiah","description":"A simple, lightweight, and easy-to-use logging library for Free Pascal applications.","archived":false,"fork":false,"pushed_at":"2025-07-09T04:30:26.000Z","size":62,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-09T22:07:57.013Z","etag":null,"topics":["free-pascal","freepascal","lazarus","lazarus-ide","logger","logging","logging-library","thread-safe"],"latest_commit_sha":null,"homepage":"","language":"Pascal","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/ikelaiah.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-02T10:35:40.000Z","updated_at":"2025-07-09T04:30:29.000Z","dependencies_parsed_at":"2025-07-02T12:34:42.992Z","dependency_job_id":null,"html_url":"https://github.com/ikelaiah/simplelog-fp","commit_stats":null,"previous_names":["ikelaiah/simplelog-fp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ikelaiah/simplelog-fp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikelaiah%2Fsimplelog-fp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikelaiah%2Fsimplelog-fp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikelaiah%2Fsimplelog-fp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikelaiah%2Fsimplelog-fp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ikelaiah","download_url":"https://codeload.github.com/ikelaiah/simplelog-fp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikelaiah%2Fsimplelog-fp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29476300,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T10:25:47.032Z","status":"ssl_error","status_checked_at":"2026-02-15T10:25:01.815Z","response_time":118,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["free-pascal","freepascal","lazarus","lazarus-ide","logger","logging","logging-library","thread-safe"],"created_at":"2026-02-15T11:13:57.423Z","updated_at":"2026-02-15T11:13:57.575Z","avatar_url":"https://github.com/ikelaiah.png","language":"Pascal","readme":"# 📝 SimpleLog-FP \n\n[![License: MIT](https://img.shields.io/badge/License-MIT-1E3A8A.svg)](https://opensource.org/licenses/MIT)\n[![Free Pascal](https://img.shields.io/badge/Free%20Pascal-3.2.2+-3B82F6.svg)](https://www.freepascal.org/)\n[![Lazarus](https://img.shields.io/badge/Lazarus-4.0+-60A5FA.svg)](https://www.lazarus-ide.org/)\n![Supports Windows](https://img.shields.io/badge/support-Windows-F59E0B?logo=Windows)\n![Supports Linux](https://img.shields.io/badge/support-Linux-F59E0B?logo=Linux)\n[![Version](https://img.shields.io/badge/version-0.5.1-8B5CF6.svg)](CHANGELOG.md)\n![No Dependencies](https://img.shields.io/badge/dependencies-none-10B981.svg)\n\n\u003e [!Note]\n\u003e SimpleLog-FP is currently in active development. This is a pre-1.0 release (v0.5.1). The API may change and feedback is welcome!\n\n\nA **simple**, **lightweight**, and **easy-to-use** logging library for Free Pascal applications.\n\n\u003e **Why SimpleLog-FP?** 🤔 Built from the need for a logging library that is actually simple to use and maintain. No feature bloat, no complexity - just clean, reliable logging for console, file, or both.\n\n## 🎯 Design Philosophy\n\n- ✅ **Simple** - Easy for new developers to understand and use\n- ✅ **Lightweight** - ~415 lines of code, no bloat\n- ✅ **Maintainable** - Clean code and easily maintainable\n- ✅ **Focused** - Does three things well: console, file, and console+file logging\n- ✅ **No dependencies** - Uses only standard Free Pascal units\n- ✅ **Cross-platform** - Works on Windows and Unix systems\n- ✅ **File rotation** - Automatic log file rotation when size limits are reached\n\n## 🚀 Quick Start\n\n### 📦 Installation\n\n**From GitHub:**\n\n```bash\ngit clone https://github.com/ikelaiah/simplelog-fp.git\ncd simplelog-fp\n```\n\n**Manual Installation:**\n\n1. Download `src/SimpleLog.pas` from this repository\n2. Copy it to your project directory\n2. Add `SimpleLog` to your uses clause\n3. Start logging!\n\n### Basic Usage\n\n```pascal\nuses SimpleLog;\n\nvar\n  Log: TSimpleLog;\nbegin\n  // Console only\n  Log := TSimpleLog.Console;\n  Log.Info('Hello World!');\n  \n  // File only  \n  Log := TSimpleLog.FileLog('app.log');\n  Log.Info('Logged to file');\n  \n  // Both console and file\n  Log := TSimpleLog.Both('app.log');\n  Log.Info('Appears in both console and file');\nend;\n```\n\n**That's it!** No complex setup, no memory management, no configuration files required.\n\n## ✨ Features\n\n### 📝 Core Logging\n\n- **5 log levels**: Debug, Info, Warning, Error, Fatal\n- **Timestamped messages**: Each log entry includes precise timestamp with milliseconds\n- **Colored console output** with appropriate colors per level\n- **File logging** with automatic directory creation\n- **Dual output** to both console and file simultaneously\n- **Format string support** for all log methods\n- **Thread safety** - protected by critical sections for multi-threaded applications\n- **Silent mode** to temporarily disable all logging output\n\n### Log Output Format\n\nAll log messages follow a consistent, readable format:\n\n```\n[2025-07-01 14:30:22.123] [INFO] Application started\n[2025-07-01 14:30:22.456] [WARNING] Low disk space: 15.5% remaining\n[2025-07-01 14:30:22.789] [ERROR] Database connection failed\n[2025-07-01 14:30:23.012] [DEBUG] User authentication successful\n[2025-07-01 14:30:23.345] [FATAL] Critical system error\n```\n\n**Timestamp format**: `yyyy-mm-dd hh:nn:ss.zzz`\n- ISO 8601 compatible date format (sortable)\n- 24-hour time format  \n- Millisecond precision for performance analysis\n- Consistent across console and file output\n\n### ⚙️ Configuration\n- **Method chaining** for fluent configuration\n- **Log level filtering** - set minimum level to reduce noise\n- **File rotation** - automatic rotation when files exceed size limit\n- **Custom file paths** with automatic directory creation\n\n### 🌍 Cross-Platform\n- **Windows**: Console colors via Windows API\n- **Unix/Linux**: Console colors via ANSI escape codes\n- **Consistent behavior** across platforms\n\n## 📚 API Reference\n\n### 🏭 Factory Methods\n```pascal\nTSimpleLog.Console              // Console output only\nTSimpleLog.FileLog('file.log')  // File output only  \nTSimpleLog.Both('file.log')     // Both console and file\n```\n\n### 🔊 Logging Methods\n```pascal\nLog.Debug('Debug message');\nLog.Info('Information');\nLog.Warning('Warning message');\nLog.Error('Error occurred');\nLog.Fatal('Critical error');\n\n// Format string variants\nLog.Info('User %s has %d items', [username, count]);\nLog.Error('Connection failed: %s:%d', [host, port]);\n```\n\n### ⛓️ Configuration (Method Chaining)\n```pascal\nLog := TSimpleLog.Console\n  .SetMinLevel(llWarning)           // Only warnings and above\n  .SetOutputs([odConsole, odFile])  // Enable both outputs\n  .SetFile('app.log')               // Set log file\n  .SetMaxFileSize(5 * 1024 * 1024)  // 5MB rotation limit\n  .SetSilent(False);                // Enable/disable all logging\n```\n\n### 🔧 Properties\n```pascal\nLog.Outputs := [odConsole, odFile];  // Set output destinations\nLog.LogFile := 'myapp.log';          // Set log file path\nLog.MinLevel := llInfo;              // Set minimum log level\nLog.MaxFileSize := 10 * 1024 * 1024; // Set rotation size (10MB)\nLog.Silent := True;                  // Enable/disable silent mode\n```\n\n## 📋 Examples\n\n### 🌟 Real-World Usage Example\n\n```pascal\nprogram MyApplication;\nuses SimpleLog;\n\nvar\n  Log: TSimpleLog;\n  UserCount: Integer;\nbegin\n  // Initialize logging to both console and file\n  Log := TSimpleLog.Both('application.log')\n    .SetMinLevel(llInfo);  // Hide debug messages in production\n  \n  Log.Info('Application starting up');\n  \n  try\n    // Your application logic\n    UserCount := LoadUsers();\n    Log.Info('Loaded %d users from database', [UserCount]);\n    \n    if UserCount = 0 then\n      Log.Warning('No users found in database');\n      \n  except\n    on E: Exception do\n    begin\n      Log.Error('Startup failed: %s', [E.Message]);\n      ExitCode := 1;\n      Exit;\n    end;\n  end;\n  \n  Log.Info('Application ready');\n  \n  // Your main application loop here...\n  \n  Log.Info('Application shutting down');\nend;\n```\n\n### 🔍 Level Filtering\n```pascal\n// Production: Only show warnings and errors\nLog := TSimpleLog.Both('prod.log').SetMinLevel(llWarning);\n\n// Development: Show everything including debug\nLog := TSimpleLog.Console.SetMinLevel(llDebug);\n```\n\n### 🔄 File Rotation\n```pascal\n// Rotate when file exceeds 1MB\nLog := TSimpleLog.FileLog('big.log').SetMaxFileSize(1024 * 1024);\nLog.Info('This will rotate when file gets too big');\n```\n\n### 🔇 Silent Mode\n```pascal\n// Temporarily disable all logging\nLog.SetSilent(True);\nLog.Error('This error will not appear anywhere');\n\n// Re-enable logging\nLog.SetSilent(False);\nLog.Info('Logging is back on');\n```\n\n### 🧵 Thread Safety\n```pascal\n// SimpleLog is thread-safe by default!\n// All logging operations are protected by a critical section.\n// You can safely use the same logger instance from multiple threads.\nvar\n  Log: TSimpleLog;\nbegin\n  Log := TSimpleLog.Both('threaded.log');\n  // Use Log from multiple threads with confidence\n  Log.Info('Multi-threaded logging works reliably');\nend;\n```\n\n## 💯 Advanced Record Benefits\n\nSimpleLog uses Free Pascal's **advanced records** instead of classes:\n\n- ✅ **No memory management** - no Create/Free needed\n- ✅ **Stack allocated** - automatic cleanup\n- ✅ **Lightweight** - minimal overhead\n- ✅ **Value semantics** - can be copied safely\n- ✅ **Modern Pascal** - leverages language features\n\n## 📁 File Structure\n\n```text\nSimpleLog-FP/\n├── src/\n│   └── SimpleLog.pas          # Main library (~415 lines)\n├── examples/\n│   ├── SimpleLogExample/      # Basic usage examples\n│   └── ThreadSafeExample/     # Concurrent logging demo\n├── tests/\n│   └── SimpleLog.Test.pas     # Comprehensive test suite\n├── docs/\n│   ├── SimpleLogger.md        # User manual\n│   └── cheat-sheet.md         # Quick API reference\n└── README.md                  # This file\n```\n\n## 🧪 Tests\n\nA comprehensive test suite is provided in the `tests/` directory. To run the tests:\n\n- Open `TestRunner.lpi` in the Lazarus IDE or use `lazbuild` (required)\n- Build and run the project to execute all tests\n- Review the output in the IDE or generated log files\n\n## 📦 Lazarus Package\n\nA ready-to-use Lazarus package is included for easy integration:\n\n- Open `packages/lazarus/simplelog.lpk` in the Lazarus IDE\n- Click \"Use\" → \"Add to Project\" to add SimpleLog-FP to your project\n- The package will automatically add the correct search paths\n\nThis is the recommended way to add SimpleLog-FP to your Lazarus projects for the best experience.\n\n## 📊 Comparison with Complex Logging Libraries\n\n| Feature | SimpleLog-FP | Complex Logger |\n|---------|--------------|----------------|\n| Lines of code | ~415 | 2000+ |\n| Learning curve | Minutes | Hours |\n| Features | 3 core outputs | 20+ features |\n| Maintenance | Easy | Complex |\n| Memory usage | Minimal | Higher |\n| Dependencies | None | Multiple |\n\n## 🤝 Contributing\n\nKeep it simple! Any contributions should maintain the core philosophy:\n\n- No feature bloat\n- Easy to understand\n- Focused on core logging needs\n\n## ⚖️ License\n\nMIT License - see [LICENSE](LICENSE.md) file for details.\n\n## 🙏 Acknowledgments\n\n- [Free Pascal Dev Team](https://www.freepascal.org/) for the Pascal compiler\n- [Lazarus IDE Team](https://www.lazarus-ide.org/) for such an amazing IDE\n- The kind and helpful individuals on various online platforms such as:\n    - [Unofficial Free Pascal discord server](https://discord.com/channels/570025060312547359/570091337173696513)\n    - [Free Pascal \u0026 Lazarus forum](https://forum.lazarus.freepascal.org/index.php)\n    - [Tweaking4All Delphi, Lazarus, Free Pascal forum](https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/)\n    - [Laz Planet - Blogspot](https://lazplanet.blogspot.com/) / [Laz Planet - GitLab](https://lazplanet.gitlab.io/)\n    - [Delphi Basics](https://www.delphibasics.co.uk/index.html)\n    - @gcarreno for various suggestions and improvements\n- All contributors who have helped improve this project\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fikelaiah%2Fsimplelog-fp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fikelaiah%2Fsimplelog-fp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fikelaiah%2Fsimplelog-fp/lists"}