From 17a3ba945d7d1211b774e3a848e327024158ffc0 Mon Sep 17 00:00:00 2001 From: tangent Date: Wed, 16 Sep 2026 19:04:09 -0600 Subject: [PATCH] Update ReadMe.md --- ReadMe.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/ReadMe.md b/ReadMe.md index 252a73f..fc064be 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,5 +1,5 @@ # microlog -A small very flexible logging library for Lua. +The best Lua logging library ever made! Public domain. Fuck IP law. @@ -7,6 +7,8 @@ Public domain. Fuck IP law. ```lua -- set arbitrary log levels to be printed immediately log{ info = true, warning = true, ducksauce = true, } +-- disable storage of messages depending on log level +log{ error = false, verbose = false, } -- send anything (except nil) to a log level log("bacom", true, "text", 5, function() end, {}) -- print all messages saved at a particular log level @@ -15,6 +17,22 @@ log("error") log(false) -- this deletes all stored messages -- set a maximum number of stored messages per log level log(50) -- warning: reaching large limits makes logging expensive +-- check if a log level is being displayed +if log.arbitrary_exit then log("arbitrary_exit") os.exit(1) end -- do anything to the stored messages (this example deletes them all) log(function(messages) return {} end) ``` + +### What if I need to send logs elsewhere? +There are tools for redirecting console output. Your code shouldn't add such +brittle dependencies. If you really need it to be in Lua, use [LuaLogging](https://lunarmodules.github.io/lualogging/). +It can output directly to a file, rolling file, email, socket, syslog, SQL, and +NGINX or OpenResty. + +### What if I want pretty colors? +Use rxi's [log.lua](https://github.com/rxi/log.lua) or add color codes in a +wrapper function, I'm not your mom. + +### What if I want my Lua to look like Java? +Why do you want that? Use [moteus/lua-log](https://github.com/moteus/lua-log) +I guess.