/** * \public * * Format a log message. This method should be used in AnewtLogHandlerBase * subclasses to format the log messages. * * \param $domain * The log domain. This can be null. * * \param $level * The log level. * * \param $message * The string to log. * * \return * Formatted log string. */ protected function format_log_message($domain = null, $level, $message) { assert('is_int($level)'); assert('is_string($message)'); $name = AnewtLog::loglevel_to_string($level); /* Without logging domain */ if (is_null($domain)) { $output = sprintf('%s: %s', $name, $message); /* With logging domain */ } else { assert('is_string($domain)'); $output = sprintf('(%s) %s: %s', $domain, $name, $message); } /* Reduce new lines and indentation and make it a single line, since * error logs should not contain newlines */ $output = str_join_wrap($output); $output = str_replace("\n", ' ', $output); return $output; }
function usage() { echo str_join_wrap('Error: please specify a filename with mail addresses to test against the validator. There should be one address per line.'); echo NL; }