Provide VRS objects with a name for more informative debugging/logging

Bug: T112330
Change-Id: Iaa3af55ebc426d54e8bef94dba5415bc535e096b
This commit is contained in:
C. Scott Ananian 2015-09-14 14:36:18 -04:00
parent 1fb06c0c71
commit 195ea84883
4 changed files with 18 additions and 1 deletions

View file

@ -54,6 +54,7 @@ class ParsoidVirtualRESTService extends VirtualRESTService {
}
// set up defaults and merge them with the given params
$mparams = array_merge( array(
'name' => 'parsoid',
'url' => 'http://localhost:8000/',
'prefix' => 'localhost',
'domain' => 'localhost',

View file

@ -48,6 +48,7 @@ class RestbaseVirtualRESTService extends VirtualRESTService {
public function __construct( array $params ) {
// set up defaults and merge them with the given params
$mparams = array_merge( array(
'name' => 'restbase',
'url' => 'http://localhost:7231/',
'domain' => 'localhost',
'timeout' => 100,

View file

@ -45,7 +45,11 @@ class SwiftVirtualRESTService extends VirtualRESTService {
* - swiftAuthTTL : Swift authentication TTL (seconds)
*/
public function __construct( array $params ) {
parent::__construct( $params );
// set up defaults and merge them with the given params
$mparams = array_merge( array(
'name' => 'swift'
), $params );
parent::__construct( $mparams );
}
/**

View file

@ -44,6 +44,17 @@ abstract class VirtualRESTService {
$this->params = $params;
}
/**
* Return the name of this service, in a form suitable for error
* reporting or debugging.
*
* @return string The name of the service behind this VRS object.
*/
public function getName() {
return isset( $this->params['name'] ) ? $this->params['name'] :
get_class( $this );
}
/**
* Prepare virtual HTTP(S) requests (for this service) for execution
*