Updated subclassing of Client/Worker LogEntry classes

This commit is contained in:
2011-04-25 00:49:09 +01:00
parent a459ba283a
commit 9be81f92f4
2 changed files with 25 additions and 56 deletions

View File

@@ -2,37 +2,22 @@
class RippingCluster_ClientLogEntry extends RippingCluster_LogEntry { class RippingCluster_ClientLogEntry extends RippingCluster_LogEntry {
protected $jobId; public static function debug($logger, $job_id, $message) {
static::log($logger, SihnonFramework_Log::LEVEL_DEBUG, $job_id, $message, 'client');
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) { public static function info($logger, $job_id, $message) {
return new self( static::log($logger, SihnonFramework_Log::LEVEL_INFO, $job_id, $message, 'client');
$row['id'],
$row['level'],
$row['ctime'],
$row['pid'],
$row['hostname'],
$row['progname'],
$row['line'],
$row['message'],
$row['job_id']
);
} }
public static function initialise() { public static function warning($logger, $job_id, $message) {
parent::$table_name = 'client_log'; static::log($logger, SihnonFramework_Log::LEVEL_WARNING, $job_id, $message, 'client');
} }
public function jobId() { public static function error($logger, $job_id, $message) {
return $this->jobId; static::log($logger, SihnonFramework_Log::LEVEL_ERROR, $job_id, $message, 'client');
} }
}; };
RippingCluster_ClientLogEntry::initialise();
?> ?>

View File

@@ -2,38 +2,22 @@
class RippingCluster_WorkerLogEntry extends RippingCluster_LogEntry { class RippingCluster_WorkerLogEntry extends RippingCluster_LogEntry {
protected $jobId; public static function debug($logger, $job_id, $message) {
static::log($logger, SihnonFramework_Log::LEVEL_DEBUG, $job_id, $message, 'worker');
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) { public static function info($logger, $job_id, $message) {
return new self( static::log($logger, SihnonFramework_Log::LEVEL_INFO, $job_id, $message, 'worker');
$row['id'],
$row['level'],
$row['ctime'],
$row['pid'],
$row['hostname'],
$row['progname'],
$row['line'],
$row['message'],
$row['job_id']
);
} }
public static function initialise() { public static function warning($logger, $job_id, $message) {
parent::$table_name = 'worker_log'; static::log($logger, SihnonFramework_Log::LEVEL_WARNING, $job_id, $message, 'worker');
} }
public function jobId() { public static function error($logger, $job_id, $message) {
return $this->jobId; static::log($logger, SihnonFramework_Log::LEVEL_ERROR, $job_id, $message, 'worker');
} }
}; };
RippingCluster_WorkerLogEntry::initialise();
?> ?>