{"id":23178356,"url":"https://github.com/chrischtel/nexlog","last_synced_at":"2025-10-25T06:31:05.613Z","repository":{"id":268246685,"uuid":"903755909","full_name":"chrischtel/nexlog","owner":"chrischtel","description":"A modern, feature-rich logging library for Zig with thread-safety, file rotation, and colorized output. High-performance logging made easy.","archived":false,"fork":false,"pushed_at":"2025-02-05T15:31:41.000Z","size":119,"stargazers_count":61,"open_issues_count":6,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-05T16:20:28.534Z","etag":null,"topics":["file-rotation","library","logging","thread-safe","zig"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/chrischtel.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-15T13:40:10.000Z","updated_at":"2025-02-05T15:31:39.000Z","dependencies_parsed_at":"2025-02-05T16:20:03.534Z","dependency_job_id":"d2384f3d-bd4d-4d1f-8afd-ad8a2942840a","html_url":"https://github.com/chrischtel/nexlog","commit_stats":null,"previous_names":["chrischtel/nexlog"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrischtel%2Fnexlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrischtel%2Fnexlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrischtel%2Fnexlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrischtel%2Fnexlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrischtel","download_url":"https://codeload.github.com/chrischtel/nexlog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238093748,"owners_count":19415298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["file-rotation","library","logging","thread-safe","zig"],"created_at":"2024-12-18T07:10:23.080Z","updated_at":"2025-10-25T06:31:00.376Z","avatar_url":"https://github.com/chrischtel.png","language":"Zig","readme":"# nexlog\n\n**nexlog** is a high-performance, flexible, and feature-rich logging library for Zig applications. Designed with both power and ease-of-use in mind, nexlog offers asynchronous logging, file rotation, structured logging, and much more — making it a perfect fit for projects of any size.\n\n---\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n- [Advanced Configuration](#advanced-configuration)\n- [Custom Handlers](#custom-handlers)\n- [JSON Logging](#json-logging)\n- [Documentation](#documentation)\n- [Contributing](#contributing)\n- [License](#license)\n\n---\n\n## Features\n\n- **Multiple Log Levels**: Supports debug, info, warning, and error levels.\n- **Asynchronous Logging**: High-performance async mode minimizes the impact on application performance.\n- **File Rotation**: Automatically rotates log files based on configurable file sizes and backup counts.\n- **Customizable Handlers**: Comes with built-in handlers for console, file, and JSON outputs; also supports custom handlers.\n- **Rich Metadata**: Automatically includes timestamps, thread IDs, file names, and function names.\n- **Structured Logging**: Provides JSON output for machine-readable logs.\n- **Color Support**: Terminal color coding for different log levels enhances readability.\n- **Configurable Buffer Size**: Adjustable buffer size for optimal performance.\n- **Context-Based Logging**: Supports department- or component-specific logging contexts.\n\n---\n\n## Installation\n\nAdd **nexlog** as a dependency in your `build.zig.zon` file.\n\n### Fetching from GitHub\n\n```bash\nzig fetch --save git+https://github.com/chrischtel/nexlog/\n```\n\nIn your `build.zig.zon`:\n\n```zig\n.{\n    .name = \"my-project\",\n    .version = \"0.1.0\",\n    .dependencies = .{\n        .nexlog = .{\n            // 🚧 Nexlog: Actively Developing\n            // Expect rapid feature growth and frequent changes.\n            // To fetch the develop branch, append `#develop` to the URL.\n            .url = \"git+https://github.com/chrischtel/nexlog/\",\n            .hash = \"...\",\n        },\n    },\n}\n```\n\n\u003e **Tip:** To fetch a specific release of **nexlog**, use:\n\u003e\n\u003e ```bash\n\u003e zig fetch --save https://github.com/chrischtel/nexlog/archive/v0.4.0.tar.gz\n\u003e ```\n\u003e\n\u003e Replace `v0.4.0` with your desired release version.\n\n---\n\n## Quick Start\n\nBelow is a basic example to help you get started:\n\n```zig\nconst std = @import(\"std\");\nconst nexlog = @import(\"nexlog\");\n\npub fn main() !void {\n    var gpa = std.heap.GeneralPurposeAllocator(.{}){};\n    defer _ = gpa.deinit();\n    const allocator = gpa.allocator();\n\n    // Initialize logger with basic configuration\n    var builder = nexlog.LogBuilder.init();\n    try builder\n        .setMinLevel(.debug)\n        .enableColors(true)\n        .enableFileLogging(true, \"logs/app.log\")\n        .build(allocator);\n    defer nexlog.deinit();\n\n    // Get the default logger\n    const logger = nexlog.getDefaultLogger() orelse return error.LoggerNotInitialized;\n\n    // Log some messages\n    logger.info(\"Application starting\", .{}, null);\n    logger.debug(\"Debug information\", .{}, null);\n    logger.warn(\"Warning message\", .{}, null);\n    logger.err(\"Error occurred\", .{}, null);\n}\n```\n\n---\n\n## Advanced Configuration\n\nnexlog's builder pattern makes advanced configuration straightforward:\n\n```zig\ntry builder\n    .setMinLevel(.debug)\n    .enableColors(true)\n    .setBufferSize(8192)\n    .enableFileLogging(true, \"logs/app.log\")\n    .setMaxFileSize(5 * 1024 * 1024)  // 5MB\n    .setMaxRotatedFiles(3)\n    .enableRotation(true)\n    .enableAsyncMode(true)\n    .enableMetadata(true)\n    .build(allocator);\n```\n\nThis configuration sets up a logger with:\n\n- A minimum log level of debug.\n- Color support enabled.\n- Custom buffer size.\n- File logging with rotation parameters.\n- Asynchronous logging and metadata inclusion.\n\n---\n\n## Custom Handlers\n\nNeed specialized logging? Create your own log handler. Here's a simple scaffold:\n\n```zig\nconst CustomHandler = struct {\n    // Implement custom handling logic here.\n};\n```\n\nFor more details, see the [Custom Handlers Documentation](#).\n\n---\n\n## JSON Logging\n\nFor structured, machine-readable logs, nexlog provides built-in JSON support:\n\n```zig\nvar json_handler = try JsonHandler.init(allocator, .{\n    .min_level = .debug,\n    .pretty_print = true,\n    .output_file = \"logs/app.json\",\n});\n```\n\nThis configuration writes prettified JSON logs to `logs/app.json`, starting at the debug level.\n\n---\n\n## Documentation\n\nFor more detailed information, check out the following resources:\n\n- [Configuration Guide](#)\n- [Handler Documentation](#)\n- [Advanced Usage Examples](#)\n- [API Reference](#)\n\n---\n\n## Contributing\n\nContributions are welcome! If you'd like to contribute:\n\n1. Fork the repository.\n2. Create a new branch for your feature or bug fix.\n3. Commit your changes.\n4. Open a Pull Request.\n\nFor major changes, please open an issue first to discuss what you would like to change.\n\n---\n\n## License\n\nThis project is licensed under the BSD 3-Clause License. See the [LICENSE](./LICENSE) file for more details.\n---\n\nHappy logging with **nexlog**!\n","funding_links":[],"categories":["Language Essentials"],"sub_categories":["Logging Processing"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrischtel%2Fnexlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrischtel%2Fnexlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrischtel%2Fnexlog/lists"}