Thesyslog()function is responsible for sending a custom message to the syslog. Its prototype follows: int syslog(int priority, string message) The first parameter,priority, specifies the syslog priority level, presented in order of severity here:
The second parameter,message, specifies the text of the message that you’d like to log. If you’d like to log the error message as provided by the PHP engine, you can include the string%min the message. This string will be replaced by the error message string (strerror) as offered by the engine at execution time. Now that you’ve been acquainted with the relevant functions, here’s an example: <?php This snippet would produce a log entry in themessagessyslog file similar to the following: -------------------------------------------- Dec 5 20:09:29 CHP8[30326]: Chapter 8 example warning. --------------------------------------------
Please check back Monday for the conclusion to this article.
blog comments powered by Disqus |