https://github.com/qwreey/logger.lua
a logging library for lua, luajit, luvit with support luvit's fs, readline, pretty-print too
https://github.com/qwreey/logger.lua
Last synced: about 1 year ago
JSON representation
a logging library for lua, luajit, luvit with support luvit's fs, readline, pretty-print too
- Host: GitHub
- URL: https://github.com/qwreey/logger.lua
- Owner: qwreey
- License: mit
- Created: 2022-01-14T13:26:02.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-09-03T22:52:37.000Z (almost 4 years ago)
- Last Synced: 2025-01-30T00:32:07.825Z (over 1 year ago)
- Language: Lua
- Size: 310 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hello World!
This library is mono module library, so if you want to use this library, just copy logger.lua into fit of directory in your workspace
This module is too simple! so it doesn need to described much!
# Install with lit package manager
```
lit install qwreey75/logger
```
# Features
## Many Lua Platforms
On every lua platform works! this library will detect what you use and select propr base librarys Like below image, it works with lua5.3, luajit, luvit and more!

## Multiple Lines
It will automatically detect new lines and adding spaces

```lua
_G.require = require -- must be need!
local logger = require "logger"
logger.info("Hello world!\nThis library supports multiple lines too!\nYou can write log pretty and easily with this!")
```
## Many Levels
It supports many levels as default! you can add more levels with editting logger.lua

```lua
_G.require = require -- must be need!
local logger = require "logger"
logger.info("Info level")
logger.debug("Debug level")
logger.error("Error level")
logger.trace("Trace level")
logger.fatal("Fatal level")
logger.warn("Warn level")
```
## Tab Character
Tab character will display as ' → │'

## Escape Special Characters
It displays special characters as highlighted text

```lua
_G.require = require -- must be need!
local logger = require "logger"
logger.info("\127") -- del key, this is will escaped
logger.info("\27[4mUNDERLINE") -- this is will not escaped
```
## Line Number / File Name
This library supports line number and file name by debug library, you can catch where log message was written!

## Formatting
You don't need to use `logger.info(string.format(...))`, you can do samething with `logger.infof`
All of levels support this

```lua
_G.require = require -- must be need!
local logger = require "logger"
local user = {}
user.name = "Qwreey"
logger.infof("User Name Is : %s",user.name)
```
## Display Table / Other Types
**WORKS ON ONLY LUVIT**
This library supports luvit's pretty-print library, so if you pass table info log function, it will automatically dump table into string and show that!

```lua
_G.require = require -- must be need!
local logger = require "logger"
logger.info({qus="It is supports table?",ans="Yes!"})
```
## Appender
TODO: description for appender
## Other Settings
TODO: description for settings