moteus / Lua Log
Licence: mit
Asynchronous logging library for Lua
Stars: ✭ 83
Programming Languages
lua
6591 projects
Labels
Projects that are alternatives of or similar to Lua Log
Android Filelogger
A general-purpose logging library with built-in support to save logs to file efficiently.
Stars: ✭ 70 (-15.66%)
Mutual labels: logging
Laravel Log To Db
Custom Laravel and Lumen 5.6+ Log channel handler that can store log events to SQL or MongoDB databases. Uses Laravel/Monolog native logging functionality.
Stars: ✭ 76 (-8.43%)
Mutual labels: logging
Logbert
Logbert is an advanced log message viewer for log4net, log4j and others.
Stars: ✭ 70 (-15.66%)
Mutual labels: logging
Flutter Boilerplate Project
A boilerplate project created in flutter using MobX and Provider.
Stars: ✭ 1,194 (+1338.55%)
Mutual labels: logging
Ring Logger
Log ring requests & responses using your favorite logging backend
Stars: ✭ 66 (-20.48%)
Mutual labels: logging
Tail
[Revamped] Go package for reading from continuously updated files (tail -f)
Stars: ✭ 81 (-2.41%)
Mutual labels: logging
Diary
📑 Zero-dependency, fast logging library for both Node and Browser.
Stars: ✭ 79 (-4.82%)
Mutual labels: logging
Browser Bunyan
An adaptation of, the Node logging library, Bunyan specifically for the browser.
Stars: ✭ 78 (-6.02%)
Mutual labels: logging
Sejil
Capture, view and filter your ASP.net core log events right from your app
Stars: ✭ 70 (-15.66%)
Mutual labels: logging
Mrbutler
Reactive Android App Permissions API with delegates and logging
Stars: ✭ 77 (-7.23%)
Mutual labels: logging
Babel Plugin Captains Log
Babel plugin that injects helpful details into console statements
Stars: ✭ 80 (-3.61%)
Mutual labels: logging
Superseriousstats
superseriousstats is a fast and efficient program to create statistics out of various types of chat logs
Stars: ✭ 78 (-6.02%)
Mutual labels: logging
Logging library for Lua 5.1/5.2
Usage
Write to roll file and to console
local LOG = require "log".new(
-- maximum log level
"trace",
-- Writer
require 'log.writer.list'.new( -- multi writers:
require 'log.writer.console.color'.new(), -- * console color
require 'log.writer.file.roll'.new( -- * roll files
'./logs', -- log dir
'events.log', -- current log name
10, -- count files
10*1024*1024 -- max file size in bytes
)
),
-- Formatter
require "log.formatter.concat".new()
)
LOG.error("some", "error")
Write to file from separate thread
local LOG = require "log".new(
require "log.writer.async.zmq".new(
'inproc://async.logger',
function() -- calls from separate thread/Lua state
return require 'log.writer.file.by_day'.new(
'./logs', 'events.log', 5000
)
end
)
)
LOG.error("some error")
More complex example
local host = arg[1] or '127.0.0.1'
local port = arg[2] or 514
-- this code run in separate thread.
local InitWriter = [[
return require 'log.writer.list'.new( -- multi writers:
require 'log.writer.console.color'.new(), -- * console color
require 'log.writer.net.zmq'.new('%{zmq_cnn_host}'), -- * zmq pub socket
require "log.writer.format".new( -- * syslog over udp
require "log.logformat.syslog".new("user"),
require 'log.writer.net.udp'.new('%{udp_cnn_host}', %{udp_cnn_port})
)
)
]]
-- create async writer and run new work thread.
-- communicate with work thread using zmq library
local writer = require "log.writer.async.zmq".new(
'inproc://async.logger',
InitWriter:gsub('%%{(.-)}', {
zmq_cnn_host = 'tcp://' .. host .. ':' .. port;
udp_cnn_host = host;
udp_cnn_port = port;
})
)
-- create new logger
local LOG = require"log".new(writer)
require "socket".sleep(0.5) -- net.zmq need time to connect
LOG.fatal("can not allocate memory")
LOG.error("file not found")
LOG.warning("cache server is not started")
LOG.info("new message is received")
LOG.notice("message has 2 file")
print("Press enter ...") io.flush() io.read()
Sendout logs to separate process/host
This example show how to send logs in 2 separate destination with 2 formats. Write to stdout as whell as to remote syslog server. In fact here no async on Lua side. Application write to network directly from main thread. But it is possible use one or more work threads that will do this.
-- Buld writer with 2 destinations
local writer = require "log.writer.list".new(
require "log.writer.format".new(
-- explicit set logformat to stdout writer
require "log.logformat.default".new(),
require "log.writer.stdout".new()
),
-- define network writer.
-- This writer has no explicit format so it will
-- use one defined for logger.
require "log.writer.net.udp".new('127.0.0.1', 514)
)
local function SYSLOG_NEW(level, ...)
return require "log".new(level, writer,
require "log.formatter.mix".new(),
require "log.logformat.syslog".new(...)
)
end
local SYSLOG = {
-- Define first syslog logger with some settings
KERN = SYSLOG_NEW('trace', 'kern'),
-- Define second syslog logger with other settings
USER = SYSLOG_NEW('trace', 'USER'),
}
SYSLOG.KERN.emerg ('emergency message')
SYSLOG.USER.alert ('alert message')
Dependences
core
writer.async.udp
- llthreads2
- or llthreads
- writer.net.udp
writer.async.zmq
- llthreads2
- or llthreads
- writer.net.zmq
writer.async.lane
- LuaLanes - This is experemental writer
writer.console.color
- ansicolors
- or lua-conio
- or cio (Windows only)
writer.file.by_day
writer.net.udp
writer.net.zmq
writer.net.smtp
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].