A modern, high-performance logging library for Zig featuring colorized output, file rotation, and comprehensive metadata tracking.
Development will mainly happen on the
develop
branch. There is not much documentation. You can look into thetests/
folder and theexamples/
folder.
- 🔒 Thread-safe by design
- 🎨 Colorized output for better readability
- 📁 File logging with automatic rotation
- 🔍 Rich metadata tracking (timestamp, thread ID, file, line, function)
- ⚡ High performance with minimal allocations
- 🛠️ Builder pattern for easy configuration
- 🎯 Multiple log levels (trace, debug, info, warn, err, critical)
Add Nexlog as a dependency in your build.zig.zon
:
zig fetch --save git+https://github.com/chrischtel/nexlog/
.{
.name = "my-project",
.version = "0.1.0",
.dependencies = .{
.nexlog = .{
// 🚧 Nexlog: Actively Developing
// Expect rapid feature growth and frequent changes
// Recommended: Use develop branch for latest improvements
// "git+https://github.com/chrischtel/nexlog#develop"
.url = "git+https://github.com/chrischtel/nexlog/",
.hash = "...",
},
},
}
- Add to your
build.zig
:
const nexlog = b.dependency("nexlog", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("nexlog", nexlog.module("nexlog"));
const config = nexlog.LogConfig{
.min_level = .info,
.enable_colors = true,
.enable_file_logging = true,
.file_path = "app.log",
.max_file_size = 10 * 1024 * 1024, // 10MB
.enable_rotation = true,
.max_rotated_files = 5,
};
trace
: Finest-grained informationdebug
: Debugging informationinfo
: General informationwarn
: Warning messageserr
: Error messagescritical
: Critical failures
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
git clone https://github.com/chrischtel/nexlog.git
cd nexlog
zig build
Run tests:
zig build test
Run examples:
zig build examples
This project is licensed under the MIT License - see the LICENSE file for details.
- Thanks to the Zig community for their support and feedback
- Inspired by great logging libraries across different languages
Your Name - @chrischtel
Project Link: https://github.com/yourusername/nexlog
Made with ❤️ in Zig