From 9c9139d0eb4244c66123fdbfd211105ede8c4b42 Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Sun, 13 Apr 2025 15:07:20 +0200 Subject: Add structured logging --- example.lua | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'example.lua') diff --git a/example.lua b/example.lua index cba5308..3ae2144 100644 --- a/example.lua +++ b/example.lua @@ -2,7 +2,7 @@ log.info("CRAZY") function maybe() log.warn("does it work?") - return log.panic("it does") + return log.error("it does") end log.info("%d sus", 10000) @@ -11,4 +11,32 @@ maybe() log.info("%d BIGGER %f?", 0-1, 0/0) +log.format("info", "sus %d", 10) + +local co = coroutine.create(function() + print("Coroutine running") +end) + +print(type(debug.getinfo(maybe))) + +log.value_info("hello this", { + is = "wow", + structured = "logging", + "noname", + 10, + crazy = { + what = "is", + going = "on", + }, + what = log.format, +-- file = io.open("example.txt", "w"), + extra = co, + info = debug.getinfo(maybe), +}) + + +-- errors +log.value_info("help") +log.value_info("help", 10) +log.format("lmao", "sus %d", 10) log.warn("%u %d","a") -- cgit v1.2.3