From 9be81f92f47431822f49185d97c45e8e088a5cd2 Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Mon, 25 Apr 2011 00:49:09 +0100 Subject: [PATCH] Updated subclassing of Client/Worker LogEntry classes --- .../RippingCluster/ClientLogEntry.class.php | 41 ++++++------------- .../RippingCluster/WorkerLogEntry.class.php | 40 ++++++------------ 2 files changed, 25 insertions(+), 56 deletions(-) diff --git a/source/lib/RippingCluster/ClientLogEntry.class.php b/source/lib/RippingCluster/ClientLogEntry.class.php index 3bcd016..4b31c2a 100644 --- a/source/lib/RippingCluster/ClientLogEntry.class.php +++ b/source/lib/RippingCluster/ClientLogEntry.class.php @@ -1,38 +1,23 @@ jobId = $jobId; - } - - public static function fromDatabaseRow($row) { - return new self( - $row['id'], - $row['level'], - $row['ctime'], - $row['pid'], - $row['hostname'], - $row['progname'], - $row['line'], - $row['message'], - $row['job_id'] - ); + + public static function debug($logger, $job_id, $message) { + static::log($logger, SihnonFramework_Log::LEVEL_DEBUG, $job_id, $message, 'client'); } - public static function initialise() { - parent::$table_name = 'client_log'; + public static function info($logger, $job_id, $message) { + static::log($logger, SihnonFramework_Log::LEVEL_INFO, $job_id, $message, 'client'); } - public function jobId() { - return $this->jobId; + public static function warning($logger, $job_id, $message) { + static::log($logger, SihnonFramework_Log::LEVEL_WARNING, $job_id, $message, 'client'); } + + public static function error($logger, $job_id, $message) { + static::log($logger, SihnonFramework_Log::LEVEL_ERROR, $job_id, $message, 'client'); + } + }; -RippingCluster_ClientLogEntry::initialise(); - -?> +?> \ No newline at end of file diff --git a/source/lib/RippingCluster/WorkerLogEntry.class.php b/source/lib/RippingCluster/WorkerLogEntry.class.php index 9439ba0..48f3091 100644 --- a/source/lib/RippingCluster/WorkerLogEntry.class.php +++ b/source/lib/RippingCluster/WorkerLogEntry.class.php @@ -2,38 +2,22 @@ class RippingCluster_WorkerLogEntry extends RippingCluster_LogEntry { - protected $jobId; - - protected function __construct($id, $level, $ctime, $pid, $hostname, $progname, $line, $message, $jobId) { - parent::__construct($id, $level, $ctime, $pid, $hostname, $progname, $line, $message); - - $this->jobId = $jobId; - } - - public static function fromDatabaseRow($row) { - return new self( - $row['id'], - $row['level'], - $row['ctime'], - $row['pid'], - $row['hostname'], - $row['progname'], - $row['line'], - $row['message'], - $row['job_id'] - ); + public static function debug($logger, $job_id, $message) { + static::log($logger, SihnonFramework_Log::LEVEL_DEBUG, $job_id, $message, 'worker'); } - public static function initialise() { - parent::$table_name = 'worker_log'; + public static function info($logger, $job_id, $message) { + static::log($logger, SihnonFramework_Log::LEVEL_INFO, $job_id, $message, 'worker'); } - - public function jobId() { - return $this->jobId; + + public static function warning($logger, $job_id, $message) { + static::log($logger, SihnonFramework_Log::LEVEL_WARNING, $job_id, $message, 'worker'); + } + + public static function error($logger, $job_id, $message) { + static::log($logger, SihnonFramework_Log::LEVEL_ERROR, $job_id, $message, 'worker'); } }; -RippingCluster_WorkerLogEntry::initialise(); - -?> +?> \ No newline at end of file