summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2014-01-16 11:00:22 +0100
committerArthur Schiwon <blizzz@owncloud.com>2014-02-11 10:49:59 +0100
commit32afdcbefec5793fb28162c456919d2b0be5cfe9 (patch)
tree335ab595a80fb3d26fb3fe967c60b4383f00b4f3 /lib
parent20bfbb0fd9316be0cbba9c2202a9b45ce7eea7f8 (diff)
downloadnextcloud-server-32afdcbefec5793fb28162c456919d2b0be5cfe9.tar.gz
nextcloud-server-32afdcbefec5793fb28162c456919d2b0be5cfe9.zip
Inject logger
Diffstat (limited to 'lib')
-rw-r--r--lib/private/share/searchresultsorter.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/private/share/searchresultsorter.php b/lib/private/share/searchresultsorter.php
index 4f8799494f5..f81a94c749d 100644
--- a/lib/private/share/searchresultsorter.php
+++ b/lib/private/share/searchresultsorter.php
@@ -12,16 +12,19 @@ class SearchResultSorter {
private $search;
private $encoding;
private $key;
+ private $log;
/**
* @param $search the search term as was given by the user
* @param $key the array key containing the value that should be compared
* against
* @param $encoding optional, encoding to use, defaults to UTF-8
+ * @param $log optional, an \OC\Log instance
*/
- public function __construct($search, $key, $encoding = 'UTF-8') {
+ public function __construct($search, $key, $encoding = 'UTF-8', \OC\Log $log = null) {
$this->encoding = $encoding;
$this->key = $key;
+ $this->log = is_null($log) ? new \OC\Log() : $log;
$this->search = mb_strtolower($search, $this->encoding);
}
@@ -32,8 +35,8 @@ class SearchResultSorter {
*/
public function sort($a, $b) {
if(!isset($a[$this->key]) || !isset($b[$this->key])) {
- \OCP\Util::writeLog('core', 'Sharing: cannot sort due to missing'.
- 'array key', \OC_Log::ERROR);
+ $this->log->error('Sharing dialogue: cannot sort due to missing array key',
+ array('app' => 'core'));
return 0;
}
$nameA = mb_strtolower($a[$this->key], $this->encoding);