Logging from the Lua scripts¶
To log messages with the main PowerDNS Recursor process, use pdnslog().
optionally specifying a syslog loglevel.
Changed in version 5.2.0: Added table as optional argument.
- pdnslog(message)¶
- pdnslog(message, level)
- pdnslog(message, level, table)
Log
messageat theWarninglevel iflevelis not set.- Parameters:¶
msg (
str) – The message to log.level (
int) – The log level to log at, see below.table (
table) – A table ofkey = valueentries to add to the structured log message.
The available loglevel values are listed in the following table:
All -
pdns.loglevels.AllAlert -
pdns.loglevels.AlertCritical -
pdns.loglevels.CriticalError -
pdns.loglevels.ErrorWarning -
pdns.loglevels.WarningNotice -
pdns.loglevels.NoticeInfo -
pdns.loglevels.InfoDebug -
pdns.loglevels.DebugNone -
pdns.loglevels.None
An example logging statement:
pdnslog('You have been warned', pdns.loglevels.Warning, { times = 3, origin = 'documentation' })