PHP to Ruby
Convert PHP code into Ruby!
-
error_log
Posted on May 2nd, 2009 No commentsThe error_log() function sends an error message to the web server’s error log, a TCP port or to a file (usually the web server’s error log).
PHP
error_log('My error message'); // => My error message
error_log() is probably one of the most common and convenient ways to debug PHP scripts, without having to install a full PHP debugger. As such, it is very popular with developers, often logging variables part way through a script, to see if the values are what they expect. Although Ruby doesn’t provide such a convenient global function, it does provide the Logger class which is much more powerful.
Ruby
require('Logger'); Logger.new('/var/log/httpd/error.log').error('My error message'); # => ERROR -- : My error message
Leave a reply


