Module posix.syslog
Control System Log.
Functions
LOG_MASK (priority) | Mask bit for given log priority. |
closelog () | Close system log. |
openlog (ident[, option[, facility=`LOG_USER`]]) | Open the system logger. |
setlogmask (mask) | Set log priority mask. |
syslog (priority, message) | Write to the system logger. |
Constants
posix.syslog | System logging constants. |
Functions
- LOG_MASK (priority)
-
Mask bit for given log priority.
Parameters:
- priority
int
one of
LOG_EMERG
,LOG_ALERT
,LOG_CRIT
,LOG_WARNING
,LOG_NOTICE
,LOG_INFO
orLOG_DEBUG
Returns:
-
int
mask bit corresponding to priority
See also:
- priority
int
one of
- closelog ()
-
Close system log.
See also:
- openlog (ident[, option[, facility=`LOG_USER`]])
-
Open the system logger.
Parameters:
- ident string all messages will start with this
- option
int
bitwise OR of zero or more of
LOG_CONS
,LOG_NDELAY
, orLOG_PID
(optional) - facility
int
one of
LOG_AUTH
,LOG_CRON
,LOG_DAEMON
,LOG_KERN
,LOG_LPR
,LOG_MAIL
,LOG_NEWS
,LOG_SECURITY
,LOG_USER
,LOG_UUCP
orLOG_LOCAL0
throughLOG_LOCAL7
(default `LOG_USER`)
See also:
- setlogmask (mask)
-
Set log priority mask.
Parameters:
- mask int bitwise OR of LOG_MASK bits.
Returns:
-
int
previous mask, if successful
Or
- nil
- string error message
- int errnum
See also:
- syslog (priority, message)
-
Write to the system logger.
Parameters:
- priority
int
one of
LOG_EMERG
,LOG_ALERT
,LOG_CRIT
,LOG_WARNING
,LOG_NOTICE
,LOG_INFO
orLOG_DEBUG
- message string log message
See also:
- priority
int
one of
Constants
- posix.syslog
-
System logging constants.
Any constants not available in the underlying system will be
nil
valued.Fields:
- LOG_AUTH int security/authorisation messages
- LOG_CONS int write directly to system console
- LOG_CRON int clock daemon
- LOG_DAEMON int system daemons
- LOG_KERN int kernel messages
- LOG_LOCAL0 int reserved for local use
- LOG_LOCAL1 int reserved for local use
- LOG_LOCAL2 int reserved for local use
- LOG_LOCAL3 int reserved for local use
- LOG_LOCAL4 int reserved for local use
- LOG_LOCAL5 int reserved for local use
- LOG_LOCAL6 int reserved for local use
- LOG_LOCAL7 int reserved for local use
- LOG_LPR int line printer subsystem
- LOG_MAIL int mail system
- LOG_NDELAY int open the connection immediately
- LOG_NEWS int network news subsystem
- LOG_PID int include process id with each log message
- LOG_USER int random user-level messages
- LOG_UUCP int unix-to-unix copy subsystem
- LOG_EMERG int system is unusable
- LOG_ALERT int action must be taken immediately
- LOG_CRIT int critical conditions
- LOG_ERR int error conditions
- LOG_WARNING int warning conditions
- LOG_NOTICE int normal but significant conditions
- LOG_INFO int informational
- LOG_DEBUG int debug-level messages
Usage:
-- Print syslog constants supported on this host. for name, value in pairs (require "posix.syslog") do if type (value) == "number" then print (name, value) end end