CoroutineLogger
class CoroutineLogger extends Logger
Logger implementation for coroutine-based Task execution.
Instead of writing to a socket for IPC (which requires pcntl_fork), this logger writes directly to the Task instance's shared state. This is safe because Swoole coroutines are cooperatively scheduled within the same thread and share memory.
Properties
| protected string | $streamBuffer | The buffer for streaming text. |
from Logger |
Methods
Log a line to the task output.
Append a chunk of text, accumulating on the current line(s).
Commit the accumulated partial text and start fresh.
Log a success message.
Log a warning message.
Log an error message.
Update the task label.
Update the task sub-label. Pass an empty string to clear.
Details
at line 22
__construct(Task $task)
Create a new CoroutineLogger instance.
at line 30
void
line(string $message)
Log a line to the task output.
at line 78
void
partial(string $chunk)
Append a chunk of text, accumulating on the current line(s).
at line 87
void
commitPartial()
Commit the accumulated partial text and start fresh.
at line 38
void
success(string $message)
Log a success message.
at line 46
void
warning(string $message)
Log a warning message.
at line 54
void
error(string $message)
Log an error message.
at line 62
void
label(string $message)
Update the task label.
at line 70
void
subLabel(string $message)
Update the task sub-label. Pass an empty string to clear.
in
Logger at line 92
protected void
write(string $message, string|null $type = null)
Write a message to the socket.
in
Logger at line 108
protected string
prefix(string $type, string $message)
Prefix a message with the identifier and type.