[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua Ecosystem
- From: Sean Conner <sean@...>
- Date: Tue, 26 Nov 2013 19:25:17 -0500
It was thus said that the Great Michal Kolodziejczyk once stated:
> On 26.11.2013 23:46, Justin Cormack wrote:
>
> >> I'm not trying to shoot your idea down, but there are issues I think you
> >> missed.
> >>
> >
> > We are going to brutally decide on a best interface and officialize it.
> > Somehow. But its going to happen...
>
> Exactly that I am sure that if such a common set of "blessed libraries"
> is to emerge, then it has to have some assumptions, for example: all
> modules return tables. I think the first step would be to design common
> API. Then, if I really want "incompatible" modules to enter this
> ecosystem, I would write wrappers to make them compatible with this API.
>
> Of course there is a question: how to design this common set of
> interfaces. I think either there will be a leader with a clear vision of
> this (any volunteer?), or it will be voted for by the community (slow
> process with lots of iterations :( ).
>
> So, in short: focus on API first, then map it on concrete
> implementations. So I do propose a "top-down" approach rather than
> "bottom-up" (trying to unite all existing implementations into common
> API - probably imposibble).
So how does this work?
Something like ...
I propose an interface to syslog (RFC-3164). The table returned shall
have the following functions:
log(level,message,...)
level = one of
'alert'
'crit' or 'critical'
'debug'
'emerge' or 'emergency'
'err' or 'error'
'info' or 'information'
'notice'
'warn' or 'warning'
message, a string, uses format string as string.format()
other parameters
open(id,facility[,options])
id = string
facility = one of
'auth'
'authpriv'
'auth3'
'auth4'
'cron'
'cron2'
'daemon'
'ftp'
'kernel'
'local0' to 'local7'
'lpr'
'mail'
'news'
'ntp'
'syslog'
'user'
'uucp'
options = table, with the following fields (not all
required):
pid boolean, log PID
cons boolean, log to console
nodelay boolean, open connection immediately
odelay boolean, wait to open connection
nowait boolean, immediately log
close()
Close a connection to the syslog daemon
setlogmask(level, ... )
only log listed levels (see log() for list of levels) to
syslog. Levels not listed will not generate an entry.
The table returned shall have the __call metamethod defined, which will be
equivilent to 'log(...)'.
If people want functions in the form of foo.error(), they can be written
as:
log = {}
for _,name in ipairs { 'alert' , 'critical' , 'debug' , 'emergency' , 'error' , 'info' , 'notice' , 'warn' } do
log[name] = function(...) syslog(name,...) end
end
-spc
- References:
- Re: Lua Ecosystem, Sean Conner
- Re: Lua Ecosystem, Michael Richter
- Re: Lua Ecosystem, Pierre Chapuis
- Re: Lua Ecosystem, Sean Conner
- Re: Lua Ecosystem, Pierre Chapuis
- Re: Lua Ecosystem, Sean Conner
- Re: Lua Ecosystem, Michal Kolodziejczyk
- Re: Lua Ecosystem, Sean Conner
- Re: Lua Ecosystem, Justin Cormack
- Re: Lua Ecosystem, Michal Kolodziejczyk