mirror of
https://github.com/TangentFoxy/lovebird.git
synced 2025-07-28 11:02:19 +00:00
Added timestamp functionality
This commit is contained in:
@@ -12,8 +12,9 @@ socket = require "socket"
|
||||
local lovebird = { _version = "0.0.1" }
|
||||
|
||||
lovebird.inited = false
|
||||
lovebird.wrapprint = true
|
||||
lovebird.host = "*"
|
||||
lovebird.wrapprint = true
|
||||
lovebird.timestamp = true
|
||||
lovebird.port = 8000
|
||||
lovebird.whitelist = { "127.0.0.1", "localhost" }
|
||||
lovebird.maxlines = 200
|
||||
@@ -61,6 +62,9 @@ local pagetemplate = [[
|
||||
form {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
.timestamp {
|
||||
color: #909090;
|
||||
}
|
||||
#header {
|
||||
background: #101010;
|
||||
height: 25px;
|
||||
@@ -190,6 +194,9 @@ end
|
||||
|
||||
function lovebird.print(...)
|
||||
local str = table.concat(map({...}, tostring), " ")
|
||||
if lovebird.timestamp then
|
||||
str = os.date('<span class="timestamp">[%H:%M:%S]</span> ') .. str
|
||||
end
|
||||
table.insert(lovebird.lines, str)
|
||||
if #lovebird.lines > lovebird.maxlines then
|
||||
table.remove(lovebird.lines, 1)
|
||||
|
Reference in New Issue
Block a user