method
log
v2_6_3 -
Show latest stable
- Class:
Syslog
log(*args)public
Log a message with the specified priority. Example:
Syslog.log(Syslog::LOG_CRIT, "Out of disk space") Syslog.log(Syslog::LOG_CRIT, "User %s logged in", ENV['USER'])
The priority levels, in descending order, are:
LOG_EMERG |
System is unusable |
LOG_ALERT |
Action needs to be taken immediately |
LOG_CRIT |
A critical condition has occurred |
LOG_ERR |
An error occurred |
LOG_WARNING |
Warning of a possible problem |
LOG_NOTICE |
A normal but significant condition occurred |
LOG_INFO |
Informational message |
LOG_DEBUG |
Debugging information |
Each priority level also has a shortcut method that logs with it’s named priority. As an example, the two following statements would produce the same result:
Syslog.log(Syslog::LOG_ALERT, "Out of memory") Syslog.alert("Out of memory")
Format strings are as for printf/sprintf, except that in addition %m is replaced with the error message string that would be returned by strerror(errno).