To add a new entry we use the addEntry() method. This example adds an example
entry to the log file:
$entry = array('status' => 'OK', 'comment' => 'Example');
$errorLog->addEntry($entry);
The great thing about this method is that if the log file doesn't exist it will be created
at this stage. When a log file is created a set of standard headers are added to the log
file. This is an example of what the headers may look like:
#
#Version: 1.0
#Date: 1954-06-07 12:00:00
#Fields: date time level c-ip status comment
#Software: Joomla! 1.5.0 Beta 2 [ Khepri ] 04-May-2007 00:00 GMT
Notice that the first line includes that common bit of PHP we use in all Joomla! PHP
files. This ensures that the log file isn't directly accessible. In order for it to work, the
log file must be a PHP file.
Entries are added beneath the header and each field is separated by a tab
character. This is an example of the entry that would be added as a result of our
previous example:
1906-12-09 12:00:00 - 192.
Pages:
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505