Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Fix README to match example, coding format/style fixes. |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
23e617c92e4357daccc6d1364abad1aa |
| User & Date: | llmII 2019-07-11 18:52:22 |
Context
| 2019-07-12 01:42 | Merging 0.1 branch into trunk - | check-in: 084886ee3b user: llmII tags: trunk | |
| 2019-07-12 00:58 | Create new branch named "0.1" | check-in: 4fb1f0ddff user: llmII tags: 0.1 | |
| 2019-07-11 18:52 | Fix README to match example, coding format/style fixes. | check-in: 23e617c92e user: llmII tags: trunk | |
| 2019-07-11 17:53 | Making README style match the code. | check-in: 4bbc7e7aa4 user: llmII tags: trunk | |
Changes
Changes to README.md.
| ︙ | ︙ | |||
13 14 15 16 17 18 19 |
* Perhaps allow dynamically adding levels and/or writers?
* Perhaps allow for name formats for log files?
* Perhaps allow for each log file to have its own folder?
## Usage
local log_config = {
-- this directory must exist!
| > | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
* Perhaps allow dynamically adding levels and/or writers?
* Perhaps allow for name formats for log files?
* Perhaps allow for each log file to have its own folder?
## Usage
local log_config = {
-- this directory must exist!
-- must end in a '/'
dir = '/tmp/simplelog/',
daemonized = true,
debug_info = true,
logs = {
default = {
levels = {
write = 'info',
print = 'info'
|
| ︙ | ︙ | |||
78 79 80 81 82 83 84 | * close(string name) - closes a previously opened log file by name * closeall() - closes all log files managed by this manager **Configuration is explained below:** Excerpt from example: | | | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
* close(string name) - closes a previously opened log file by name
* closeall() - closes all log files managed by this manager
**Configuration is explained below:**
Excerpt from example:
dir = '/tmp/simplelog/',
daemonized = true,
debug_info = true,
logs = {
default = {
levels = {
write = 'info',
print = 'info'
|
| ︙ | ︙ |
Changes to simplelog.lua.
| ︙ | ︙ | |||
39 40 41 42 43 44 45 | local function nop() end local nops = '' -- hold a ref to an empty string local function snop() return nops end local fmt_string = '[%s/%-6s%s] %s: %s' local function getlogstr(log_name, log_level, srclineinfo, str) | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
local function nop() end
local nops = '' -- hold a ref to an empty string
local function snop() return nops end
local fmt_string = '[%s/%-6s%s] %s: %s'
local function getlogstr(log_name, log_level, srclineinfo, str)
return fmt_string:format
(
log_name, log_level, os.date(), srclineinfo, str
)
end
local function getsrclineinfo()
local info = debug.getinfo(3, 'Sl')
|
| ︙ | ︙ | |||
205 206 207 208 209 210 211 |
end,
closeall = function(self)
for _, log in pairs(self.logs) do
log:close()
end
self.logs = {}
| | < < > | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
end,
closeall = function(self)
for _, log in pairs(self.logs) do
log:close()
end
self.logs = {}
end
}
log_base.__index = log_base
log_base.__gc = log_base.closeall
local log_class = setmetatable(
{
__init = function(self, config)
self.conf, self.logs = config, {}
return self
end
|
| ︙ | ︙ |