professional-php-11-class.fileLoggerBackend.php / php
<?php require_once('Logger/class.LoggerBackend.php'); class fileLoggerBackend extends LoggerBackend { private hLogFile; public function __construct(cfg; //system configuration info array from some external file parent::__construct(this->logLevel = logFilePath = logFilePath)) { throw new Exception('No log file path was specified ' . 'in the connection string.'); } //Open a handle to the log file. Suppress PHP error messages. //We'll deal with those ourselves by throwing an exception. logFilePath, 'a+'); if(! is_resource(logFilePath " . 'could not be opened or created for ' . 'writing. Check file permissions.'); } } public function logMessage(logLevel = LOGGER_INFO, logLevel <= time = strftime('\ %x\ %X', time()); msg); msg); logLevel); if(isset(module = str_replace("\t", ' ', module = str_replace("\n", ' ', //logs: date/time loglevel message modulename //separated by tabs, new line delimited logLine = "strLogLevel\tmodule\n"; fwrite(logLine); } } } ?>
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.