Skip to content

A modern, feature-rich logging library for Zig with thread-safety, file rotation, and colorized output. High-performance logging made easy.

License

Notifications You must be signed in to change notification settings

chrischtel/nexlog

Repository files navigation

Nexlog

A modern, high-performance logging library for Zig featuring colorized output, file rotation, and comprehensive metadata tracking.

Zig License

Development will mainly happen on the develop branch. There is not much documentation. You can look into the tests/ folder and the examples/ folder.

Features

  • 🔒 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)

Quick Start

Please note that the only examples currently available and up-to-date are in the examples/ folder.

Installation

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 = "...",
        },
    },
}
  1. Add to your build.zig:
    const nexlog = b.dependency("nexlog", .{
        .target = target,
        .optimize = optimize,
    });

    exe.root_module.addImport("nexlog", nexlog.module("nexlog"));

Advanced Usage

Configuration Options

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,
};

Log Levels

  • trace: Finest-grained information
  • debug: Debugging information
  • info: General information
  • warn: Warning messages
  • err: Error messages
  • critical: Critical failures

Contributing

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.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Building from Source

git clone https://github.com/chrischtel/nexlog.git
cd nexlog
zig build

Run tests:

zig build test

Run examples:

zig build examples

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Thanks to the Zig community for their support and feedback
  • Inspired by great logging libraries across different languages

Contact

Your Name - @chrischtel

Project Link: https://github.com/yourusername/nexlog


Made with ❤️ in Zig

About

A modern, feature-rich logging library for Zig with thread-safety, file rotation, and colorized output. High-performance logging made easy.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages