@@ -18,9 +18,9 @@ class WebLogger implements LoggerInterface
18
18
/**
19
19
* Log File
20
20
*
21
- * @const string
21
+ * @var string
22
22
*/
23
- const LOG_WEB = 'install.log ' ;
23
+ protected $ logFile = 'install.log ' ;
24
24
25
25
/**
26
26
* Currently open file resource
@@ -46,10 +46,14 @@ class WebLogger implements LoggerInterface
46
46
/**
47
47
* Constructor
48
48
* @param Filesystem $filesystem
49
+ * @param string $logFile
49
50
*/
50
- public function __construct (Filesystem $ filesystem )
51
+ public function __construct (Filesystem $ filesystem, $ logFile = null )
51
52
{
52
53
$ this ->directory = $ filesystem ->getDirectoryWrite (DirectoryList::LOG );
54
+ if ($ logFile ) {
55
+ $ this ->logFile = $ logFile ;
56
+ }
53
57
}
54
58
55
59
/**
@@ -105,7 +109,7 @@ public function logMeta($message)
105
109
*/
106
110
private function writeToFile ($ message )
107
111
{
108
- $ this ->directory ->writeFile (self :: LOG_WEB , $ message , 'a+ ' );
112
+ $ this ->directory ->writeFile ($ this -> logFile , $ message , 'a+ ' );
109
113
}
110
114
111
115
/**
@@ -115,7 +119,7 @@ private function writeToFile($message)
115
119
*/
116
120
public function get ()
117
121
{
118
- $ fileContents = explode ('\n ' , $ this ->directory ->readFile (self :: LOG_WEB ));
122
+ $ fileContents = explode ('\n ' , $ this ->directory ->readFile ($ this -> logFile ));
119
123
return $ fileContents ;
120
124
}
121
125
@@ -126,8 +130,8 @@ public function get()
126
130
*/
127
131
public function clear ()
128
132
{
129
- if ($ this ->directory ->isExist (self :: LOG_WEB )) {
130
- $ this ->directory ->delete (self :: LOG_WEB );
133
+ if ($ this ->directory ->isExist ($ this -> logFile )) {
134
+ $ this ->directory ->delete ($ this -> logFile );
131
135
}
132
136
}
133
137
0 commit comments