A high-performance logging library for Lua using Rust's tracing framework via FFI.
- High Performance: Built with Rust for optimal performance
- Flexible Logging Levels: Support for trace, debug, info, warn, and error levels
- Log Rotation: Configurable time-based and size-based log rotation
- Cross Platform: Works on macOS, Linux, and Windows
- Easy Integration: Simple Lua FFI interface
./build.shlocal logger_module = require "lua.loggger"
-- Create a logger with hourly rotation
local logger = logger_module.create_logger("logs/app.log", "info", 3600, 24, -1)
-- Log messages
logger:info("Application started")
logger:debug("Debug information")
logger:warn("Warning message")
logger:error("Error occurred")Run the example:
luajit example/example.lualocal logger = logger_module.create_logger(log_path, log_level, interval, max_kept, max_size)Parameters:
log_path: Log file path (default: "logs/app.log")log_level: Logging level - "trace", "debug", "info", "warn", "error" (default: "info")interval: Rotation interval in seconds (0 = no time rotation)max_kept: Maximum number of log files to keepmax_size: Maximum file size in bytes (-1 = no size rotation)
logger:trace("message")
logger:debug("message")
logger:info("message")
logger:warn("message")
logger:error("message")
logger:log(level, "message") -- Generic logging- Rust (for building)
- LuaJIT with FFI support
- Cargo