/luafmt

Lua placeholder style formatting library, log function

Primary LanguageCMIT LicenseMIT

luafmt

Copyright (c) 2013-2018 brinkqiang (brink.qiang@gmail.com)

luafmt License blog Open Source Love GitHub stars GitHub forks

Build status

Linux MacOSX Windows
lin-badge osx-badge win-badge

env

install cmake

Intro

luafmt based on fmt

lua ../script/main.lua

-- lua script

local luafmt = require("luafmt")

luafmt.trace("{}{}", "hello", 2020)
luafmt.debug("{}{}", "hello", 2020)
luafmt.info("{}{}", "hello", 2020)
luafmt.warn("{}{}", "hello", 2020)
luafmt.error("{}{}", "hello", 2020)
luafmt.critical("{}{}", "hello", 2020)

print(luafmt.format("{0}{1}", "hello", 2020))
print(luafmt.format("{1}{0}", "hello", 2020))

out

[2020-12-12 22:18:45 060273] [19372][trace] hello2020
[2020-12-12 22:18:45 060462] [19372][debug] hello2020
[2020-12-12 22:18:45 060648] [19372][info] hello2020
[2020-12-12 22:18:45 060759] [19372][warning] hello2020
[2020-12-12 22:18:45 060909] [19372][error] hello2020
[2020-12-12 22:18:45 061039] [19372][critical] hello2020
hello2020
2020hello

Contacts

Join the chat

Thanks