@@ -49,10 +49,10 @@ public function __construct(?string $directory, $email = null, BlueScreen $blueS
49
49
/**
50
50
* Logs message or exception to file and sends email notification.
51
51
* @param mixed $message
52
- * @param string $priority one of constant ILogger::INFO, WARNING, ERROR (sends email), EXCEPTION (sends email), CRITICAL (sends email)
52
+ * @param string $level one of constant ILogger::INFO, WARNING, ERROR (sends email), EXCEPTION (sends email), CRITICAL (sends email)
53
53
* @return string|null logged error filename
54
54
*/
55
- public function log ($ message , $ priority = self ::INFO )
55
+ public function log ($ message , $ level = self ::INFO )
56
56
{
57
57
if (!$ this ->directory ) {
58
58
throw new \LogicException ('Logging directory is not specified. ' );
@@ -64,7 +64,7 @@ public function log($message, $priority = self::INFO)
64
64
? $ this ->getExceptionFile ($ message )
65
65
: null ;
66
66
$ line = static ::formatLogLine ($ message , $ exceptionFile );
67
- $ file = $ this ->directory . '/ ' . strtolower ($ priority ?: self ::INFO ) . '.log ' ;
67
+ $ file = $ this ->directory . '/ ' . strtolower ($ level ?: self ::INFO ) . '.log ' ;
68
68
69
69
if (!@file_put_contents ($ file , $ line . PHP_EOL , FILE_APPEND | LOCK_EX )) { // @ is escalated to exception
70
70
throw new \RuntimeException ("Unable to write to log file ' $ file'. Is directory writable? " );
@@ -74,7 +74,7 @@ public function log($message, $priority = self::INFO)
74
74
$ this ->logException ($ message , $ exceptionFile );
75
75
}
76
76
77
- if (in_array ($ priority , [self ::ERROR , self ::EXCEPTION , self ::CRITICAL ], true )) {
77
+ if (in_array ($ level , [self ::ERROR , self ::EXCEPTION , self ::CRITICAL ], true )) {
78
78
$ this ->sendEmail ($ message );
79
79
}
80
80
0 commit comments