Git Repository Public Repository

namibia

URLs

Copy to Clipboard
 
f5b7b4d27eead0d7a32711409257710adb5e16c5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php

#-> Root ourselves.
date_default_timezone_set('Africa/Johannesburg');


#-> Our primary workspace for getting stuff done.
class Logger
{


	/**
	 * Log something to the error log.
	 * @param  GearmanJob $job
	 * @return null
	 */
	static public function log(GearmanJob $job)
	{
		#-> Unpack.
		$request = json_decode($job->workload(), true);
		error_log(
			is_object($request['message']) || is_array($request['message'])
				? print_r($request['message'], true)
				: $request['message']
		);
	}


}



#-> Register as a gearman worker.
$worker = new GearmanWorker();
$worker->addServer();
$worker->addFunction('Log', array('Logger', 'log'));

#-> Wait for jobs to come in.
while ($worker->work())
{
	;
}

Commits for namibia/workers/Logger.php

Diff revisions: vs.
Revision Author Commited Message
df0489 ... Mark Fri 14 Oct, 2016 10:01:00 +0000

initial commit