-- Example usage of the Lua FFI logger with new parameter structure
local logger_module = require "lua.loggger"

-- Create a logger with hourly rotation (3600 seconds), keep 24 files, no size limit
local logger = logger_module.create_logger("logs/myapp.log", "debug", 3600, 24, -1)

-- Log messages at different levels
logger:info("Application started")
logger:debug("Debug information: user_id=123")
logger:warn("Warning: disk space is running low")
logger:error("Error: failed to connect to database")

-- Create a logger with daily rotation (86400 seconds), keep 30 files, no size limit
local daily_logger = logger_module.create_logger("logs/daily.log", "info", 86400, 30, -1)
daily_logger:info("Daily log message")

-- Create a logger with size-based rotation (10MB = 10*1024*1024 bytes), keep 10 files
local size_logger = logger_module.create_logger("logs/size.log", "info", 0, 10, 10 * 1024 * 1024)
size_logger:info("Size-based rotation test message")

-- Create a logger with both time and size rotation (hourly or 5MB, keep 7 files)
local hybrid_logger = logger_module.create_logger("logs/hybrid.log", "info", 3600, 7, 5 * 1024 * 1024)
hybrid_logger:info("Hybrid rotation test message")

-- Use the generic log function
logger:log("trace", "This is a trace message")
logger:log("info", "This is an info message via generic log function")

print("Logging completed. Check the logs directory for output files.")
print("Parameter format: log_path, log_level, interval(seconds), max_kept, max_size(bytes)")
print("Examples:")
print("  - Hourly rotation: interval=3600, max_kept=24")
print("  - Daily rotation: interval=86400, max_kept=30")
print("  - Size rotation: interval=0, max_size=10*1024*1024")
print("  - Hybrid rotation: interval=3600, max_size=5*1024*1024")
