summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc/Logger.php24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/Logger.php b/src/Logger.php
index f5898df..f9af376 100755
--- a/src/Logger.php
+++ b/src/Logger.php
@@ -117,19 +117,25 @@ class Logger extends AbstractLogger
mkdir($logDirectory, $this->defaultPermissions, true);
}
- // Check for a set filename. In that case ignore prefix and extension
- if ($this->options['filename']) {
- $this->logFilePath = $logDirectory.DIRECTORY_SEPARATOR.$this->options['filename'];
+ if($logDirectory === "php://stdout") {
+ $this->logFilePath = $logDirectory;
+ $this->fileHandle = fopen($this->logFilePath, 'w+');
} else {
- $this->logFilePath = $logDirectory.DIRECTORY_SEPARATOR.$this->options['prefix'].date('Y-m-d').'.'.$this->options['extension'];
- }
-
+ if ($this->options['filename']) {
+ $this->logFilePath = $logDirectory.DIRECTORY_SEPARATOR.$this->options['filename'];
+ } else {
+ $this->logFilePath = $logDirectory.DIRECTORY_SEPARATOR.$this->options['prefix'].date('Y-m-d').'.'.$this->options['extension'];
+ }
- if (file_exists($this->logFilePath) && !is_writable($this->logFilePath)) {
- throw new RuntimeException('The file could not be written to. Check that appropriate permissions have been set.');
+ if(file_exists($this->logFilePath) && !is_writable($this->logFilePath)) {
+ throw new RuntimeException('The file could not be written to. Check that appropriate permissions have been set.');
+ }
+ $this->fileHandle = fopen($this->logFilePath, 'a');
+ if(!$this->fileHandle) {
+ throw new RuntimeException('The file could not be opened. Check permissions.');
+ }
}
- $this->fileHandle = fopen($this->logFilePath, 'a');
if ( ! $this->fileHandle) {
throw new RuntimeException('The file could not be opened. Check permissions.');
}