git.cweiske.de
/
shpub.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
940e99e
)
replace echo with Log:: calls
author
Christian Weiske
<cweiske@cweiske.de>
Tue, 13 Sep 2016 15:03:48 +0000
(17:03 +0200)
committer
Christian Weiske
<cweiske@cweiske.de>
Tue, 13 Sep 2016 15:03:48 +0000
(17:03 +0200)
src/shpub/Cli.php
patch
|
blob
|
history
src/shpub/Command/Connect.php
patch
|
blob
|
history
src/shpub/Command/Like.php
patch
|
blob
|
history
src/shpub/Command/Note.php
patch
|
blob
|
history
src/shpub/Command/Reply.php
patch
|
blob
|
history
src/shpub/Command/Server.php
patch
|
blob
|
history
src/shpub/Log.php
patch
|
blob
|
history
src/shpub/Request.php
patch
|
blob
|
history
diff --git
a/src/shpub/Cli.php
b/src/shpub/Cli.php
index 12eeaedecfdfb1c63b4e8caebee5ae492314de2d..30c2d1fd9f5be8c4b0b08d52e0bfb00991ad3e03 100644
(file)
--- a/
src/shpub/Cli.php
+++ b/
src/shpub/Cli.php
@@
-41,7
+41,7
@@
class Cli
break;
}
} catch (\Exception $e) {
break;
}
} catch (\Exception $e) {
-
echo 'Error: ' . $e->getMessage() . "\n"
;
+
Log::err('Error: ' . $e->getMessage())
;
exit(1);
}
}
exit(1);
}
}
diff --git
a/src/shpub/Command/Connect.php
b/src/shpub/Command/Connect.php
index 668d7e90419a30c8001fe9f105fbfe7fd55889ee..2fd6d3800c4a11343d8c8118f6046164a5bac93a 100644
(file)
--- a/
src/shpub/Command/Connect.php
+++ b/
src/shpub/Command/Connect.php
@@
-36,9
+36,10
@@
class Command_Connect
list($redirect_uri, $socketStr) = $this->getHttpServerData();
$state = time();
list($redirect_uri, $socketStr) = $this->getHttpServerData();
$state = time();
- echo "To authenticate, open the following URL:\n"
+ Log::msg(
+ "To authenticate, open the following URL:\n"
. $this->getBrowserAuthUrl($host, $user, $redirect_uri, $state)
. $this->getBrowserAuthUrl($host, $user, $redirect_uri, $state)
-
. "\n"
;
+
)
;
$authParams = $this->startHttpServer($socketStr);
if ($authParams['state'] != $state) {
$authParams = $this->startHttpServer($socketStr);
if ($authParams['state'] != $state) {
@@
-72,7
+73,7
@@
class Command_Connect
}
$this->cfg->hosts[$hostKey] = $host;
$this->cfg->save();
}
$this->cfg->hosts[$hostKey] = $host;
$this->cfg->save();
-
echo "Server configuration $hostKey saved successfully.\n"
;
+
Log::info("Server configuration $hostKey saved successfully.")
;
}
protected function fetchAccessToken(
}
protected function fetchAccessToken(
diff --git
a/src/shpub/Command/Like.php
b/src/shpub/Command/Like.php
index fb396be6c7eaf93519d86373615ec8579da2c79a..5b456f955a56de5688d94af4e6051cf9d522b04d 100644
(file)
--- a/
src/shpub/Command/Like.php
+++ b/
src/shpub/Command/Like.php
@@
-46,8
+46,8
@@
class Command_Like extends Command_AbstractProps
Log::err($res->getBody());
exit(20);
} else {
Log::err($res->getBody());
exit(20);
} else {
-
echo "Like created at server\n"
;
-
echo $postUrl . "\n"
;
+
Log::info('Like created at server')
;
+
Log::msg($postUrl)
;
}
}
}
}
}
}
diff --git
a/src/shpub/Command/Note.php
b/src/shpub/Command/Note.php
index de6794890711f4d73fd9354c7583ff06370a683e..1ea599b57e847386d596ee149513e8fde61d5bd7 100644
(file)
--- a/
src/shpub/Command/Note.php
+++ b/
src/shpub/Command/Note.php
@@
-36,8
+36,8
@@
class Command_Note extends Command_AbstractProps
$res = $req->send();
$postUrl = $res->getHeader('Location');
$res = $req->send();
$postUrl = $res->getHeader('Location');
-
echo "Post created at server\n"
;
-
echo $postUrl . "\n"
;
+
Log::info('Post created at server')
;
+
Log::msg($postUrl)
;
}
}
?>
}
}
?>
diff --git
a/src/shpub/Command/Reply.php
b/src/shpub/Command/Reply.php
index e84a055f39d91d7fae1183b780500cf546ac7cce..b67d46b23b42bfdb7ee69671bee6d3f998b0f5af 100644
(file)
--- a/
src/shpub/Command/Reply.php
+++ b/
src/shpub/Command/Reply.php
@@
-50,8
+50,8
@@
class Command_Reply extends Command_AbstractProps
$res = $req->send();
$postUrl = $res->getHeader('Location');
$res = $req->send();
$postUrl = $res->getHeader('Location');
-
echo "Reply created at server\n"
;
-
echo $postUrl . "\n"
;
+
Log::info('Reply created at server')
;
+
Log::msg($postUrl)
;
}
}
?>
}
}
?>
diff --git
a/src/shpub/Command/Server.php
b/src/shpub/Command/Server.php
index 59843d4d33de1de36e9d857e8c1651ee6de3f2f3..8553414b214c9170f5e6daab9cd03d84313ed2bf 100644
(file)
--- a/
src/shpub/Command/Server.php
+++ b/
src/shpub/Command/Server.php
@@
-11,10
+11,10
@@
class Command_Server
public function run($verbose)
{
foreach ($this->cfg->hosts as $key => $host) {
public function run($verbose)
{
foreach ($this->cfg->hosts as $key => $host) {
-
echo $key . "\n"
;
+
Log::msg($key)
;
if ($verbose) {
if ($verbose) {
-
echo ' URL: ' . $host->server . "\n"
;
-
echo ' User: ' . $host->user . "\n"
;
+
Log::msg(' URL: ' . $host->server)
;
+
Log::msg(' User: ' . $host->user)
;
}
}
}
}
}
}
diff --git
a/src/shpub/Log.php
b/src/shpub/Log.php
index 99d9694909473df853671d893a47005564515b49..7b9dc719897f3259d2419e53e167a4d55a0f0c4d 100644
(file)
--- a/
src/shpub/Log.php
+++ b/
src/shpub/Log.php
@@
-3,6
+3,16
@@
namespace shpub;
class Log
{
class Log
{
+ public static function info($msg)
+ {
+ echo $msg . "\n";
+ }
+
+ public static function msg($msg)
+ {
+ echo $msg . "\n";
+ }
+
public static function err($msg)
{
file_put_contents('php://stderr', $msg . "\n", FILE_APPEND);
public static function err($msg)
{
file_put_contents('php://stderr', $msg . "\n", FILE_APPEND);
diff --git
a/src/shpub/Request.php
b/src/shpub/Request.php
index 0924ddae1cf54ba725636b4294e336b2db895dc7..8ee7c5a25f15b37ace9527b15b15195a157267f0 100644
(file)
--- a/
src/shpub/Request.php
+++ b/
src/shpub/Request.php
@@
-114,6
+114,6
@@
class Request
$command .= ' ' . escapeshellarg((string) $this->req->getUrl());
$command .= ' ' . escapeshellarg((string) $this->req->getUrl());
-
echo $command . "\n"
;
+
Log::msg($command)
;
}
}
\ No newline at end of file
}
}
\ No newline at end of file