Ent - simple & easy to use logging library
Posted: Thu Jan 13, 2022 7:15 pm
Hello guys & gals, here is my logging lib 'Ent'. Here's some features straight from the readme:
The main caveat to using Ent is by design - only 1 log file can be created per session. This is to emphasise ease of use (no need to be juggling filenames).
Another thing to note is that the output functions are created dynamically from the configured log levels. By default it comes with 7 levels which can be accessed as such:
All ouput functions use the same signature as `string.format` and will perform the formatting. The output will have the timestamp and log level prepended to the input.
Repo link: https://github.com/Lafolie/ent
- Minimal, simple API
- Threaded to prevent disk I/O lag spikes
- Outputs to HTML or plaintext
- Automatically removes old log files (configurable)
- Customisable log levels
- Easy to integrate
Code: Select all
ent = require "ent"
function love.load()
-- create the logfile & writer thread
ent.init()
end
function love.keypressed(key)
-- log keypresses from the player
ent.echo(key)
end
function love.quit()
-- close the logfile & writer thread
ent.close()
end
Another thing to note is that the output functions are created dynamically from the configured log levels. By default it comes with 7 levels which can be accessed as such:
Code: Select all
ent.echo
ent.info
ent.warn
ent.error
ent.edit
ent.client
ent.server
Code: Select all
local str = ent.info("Obey %s", "love")