Skip to content

Commit 8a1320d

Browse files
b7kichFoxDigitalMarketingIT
authored andcommitted
logging debug messages to error_log() for safety
1 parent 86b67e3 commit 8a1320d

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ require_once('class.GitHubHook.php');
2727
// Initiate the GitHub Deployment Hook
2828
$hook = new GitHubHook;
2929

30-
// Enable the debug log, kindly make `log/hook.log` writable
30+
// Enable the debug log (sent to error_log)
3131
$hook->enableDebug();
3232

3333
// Adding `stage` branch to deploy for `staging` to path `/var/www/testhook/stage`

class.GitHubHook.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ public function addBranch($name = 'master', $title = 'development', $path = '/va
143143
*/
144144
public function log($message) {
145145
if ($this->_debug) {
146-
file_put_contents('log/hook.log', '[' . date('Y-m-d H:i:s') . '] - ' . $message . PHP_EOL, FILE_APPEND);
147-
}
146+
error_log($message);
147+
}
148148
}
149149

150150
/**

hook.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Initiate the GitHub Deployment Hook
55
$hook = new GitHubHook;
66

7-
// Enable the debug log, kindly make `log/hook.log` writable
7+
// Enable the debug log (sent to error_log)
88
$hook->enableDebug();
99

1010
// Adding `stage` branch to deploy for `staging` to path `/var/www/testhook/stage`
@@ -14,4 +14,4 @@
1414
$hook->addBranch('prod', 'production', '/var/www/prod', array('user@gmail.com'));
1515

1616
// Deploy the commits
17-
$hook->deploy();
17+
$hook->deploy();

log/hook.log

Whitespace-only changes.

0 commit comments

Comments
 (0)