@@ -28,6 +28,11 @@ class Config
28
28
* @var bool
29
29
*/
30
30
private $ logUncaughtErrors ;
31
+ /**
32
+ * If true, PHP warnings will be sent to the error channel, otherwise - to the debug channel
33
+ * @var bool
34
+ */
35
+ private $ logPhpWarningsToError ;
31
36
/**
32
37
* Log message formatting string.
33
38
* Available variables: {{task_id}}, {{task_type}}, {{TASK_TYPE}}, {{task_name}}, {{TASK_NAME}},
@@ -104,20 +109,21 @@ class Config
104
109
* @param ?LoggerInterface $logger PSR-3 is a compatible logger. If null - the log will be sent to the STDOUT/STDERR.
105
110
* @param mixed $debugLog False/null - debug log disabled. True - enabled (STDOUT/DEBUG). Or set custom PSR-3 level.
106
111
* @param mixed $errorLog False/null - error log disabled. True - enabled (STDERR/ERROR). Or set custom PSR-3 level.
107
- * @param bool $logUncaughtErrors Registers shutdown function for logging PHP runtime fatal errors
112
+ * @param bool $logUncaughtErrors Registers shutdown function for logging PHP runtime fatal errors.
113
+ * @param bool $logPhpWarningsToError If true, PHP warnings will be sent to the error channel, otherwise - to the debug channel.
108
114
* @param ?string $logMessageFormat Log message formatting string. Available {{task_id}}, {{task_type}}, {{task_name}},
109
115
* {{message}} and {{task_description}} variables. Lowercase for regular case, uppercase - for forced uppercase.
110
- * Pass null for default formatting: "[{{task_id}}. {{TASK_TYPE}} '{{task_name}}']: {{message}}"
116
+ * Pass null for default formatting: "[{{task_id}}. {{TASK_TYPE}} '{{task_name}}']: {{message}}".
111
117
* @param ?int $maxLogMsgLength The maximum length of the log message (the longer one will be truncated)
112
118
* @param ?array $exceptionLogMatching Mapping specific exceptions to PSR-3 log channels (class => level).
113
119
* @param ?string $logExceptionFormat Exception formatting string. Available {{header}}, {{code}}, {{class}},
114
120
* {{message}} and {{stacktrace}} variables. Pass null for default formatting:
115
- * "{{header}}\n[code]: {{code}}\n[exception]: {{class}}\n[message]: {{message}}\n[stacktrace]:\n{{stacktrace}}"
116
- * @param ?int $maxExceptionMsgLength The maximum length of the exception message (the longer one will be truncated)
117
- * @param bool $defaultPreventOverlapping Determines if an overlapping task can be run launched
118
- * @param int $defaultLockResetTimeout Locking reset timeout in minutes (to prevent freezing tasks)
119
- * @param int $defaultTries The number of attempts to execute the task in case of an error
120
- * @param int $defaultTryDelay Delay before new try
121
+ * "{{header}}\n[code]: {{code}}\n[exception]: {{class}}\n[message]: {{message}}\n[stacktrace]:\n{{stacktrace}}".
122
+ * @param ?int $maxExceptionMsgLength The maximum length of the exception message (the longer one will be truncated).
123
+ * @param bool $defaultPreventOverlapping Determines if an overlapping task can be run launched.
124
+ * @param int $defaultLockResetTimeout Locking reset timeout in minutes (to prevent freezing tasks).
125
+ * @param int $defaultTries The number of attempts to execute the task in case of an error.
126
+ * @param int $defaultTryDelay Delay before new try.
121
127
* @param int $minimumIntervalLength Minimum interval in minutes for task's addInterval method.
122
128
* ATTENTION: a low value can cause to skipped tasks, change at your own risk.
123
129
* @throws Exception
@@ -127,6 +133,7 @@ public function __construct(
127
133
$ debugLog = false ,
128
134
$ errorLog = true ,
129
135
bool $ logUncaughtErrors = false ,
136
+ bool $ logPhpWarningsToError = false ,
130
137
?string $ logMessageFormat = null ,
131
138
?int $ maxLogMsgLength = null ,
132
139
?array $ exceptionLogMatching = [],
@@ -144,6 +151,7 @@ public function __construct(
144
151
$ this ->debugLog = $ debugLog ;
145
152
$ this ->errorLog = $ errorLog ;
146
153
$ this ->logUncaughtErrors = $ logUncaughtErrors ;
154
+ $ this ->logPhpWarningsToError = $ logPhpWarningsToError ;
147
155
$ this ->logMessageFormat = $ logMessageFormat ?? "[{{task_id}}. {{TASK_TYPE}} '{{task_name}}']: {{message}} " ;
148
156
149
157
if ($ maxLogMsgLength !== null && $ maxLogMsgLength <= 0 ) {
@@ -224,6 +232,15 @@ public function getLogUncaughtErrors(): bool
224
232
return $ this ->logUncaughtErrors ;
225
233
}
226
234
235
+ /**
236
+ * If true, PHP warnings will be sent to the error channel, otherwise - to the debug channel
237
+ * @return bool
238
+ */
239
+ public function getLogPhpWarningsToError (): bool
240
+ {
241
+ return $ this ->logPhpWarningsToError ;
242
+ }
243
+
227
244
/**
228
245
* Log message formatting string.
229
246
* Available variables: {{task_id}}, {{task_type}}, {{TASK_TYPE}}, {{task_name}}, {{TASK_NAME}},
0 commit comments