master

laravel/framework

Last updated at: 29/12/2023 09:24

MessageLogged.php

TLDR

The MessageLogged.php file is a class file that defines the MessageLogged class. This class represents an event that is triggered when a log message is logged. It contains properties to store the log level, the log message, and the log context.

Classes

MessageLogged

The MessageLogged class represents an event that is triggered when a log message is logged. It has the following properties:

  • level: The log "level" indicating the severity of the log message. It is a string.
  • message: The log message itself. It is also a string.
  • context: The context of the log message, which is an array.

The class has a constructor method that accepts the log level, log message, and an optional log context. Upon instantiation, the provided values are assigned to the respective properties of the class.

<?php

namespace Illuminate\Log\Events;

class MessageLogged
{
    /**
     * The log "level".
     *
     * @var string
     */
    public $level;

    /**
     * The log message.
     *
     * @var string
     */
    public $message;

    /**
     * The log context.
     *
     * @var array
     */
    public $context;

    /**
     * Create a new event instance.
     *
     * @param  string  $level
     * @param  string  $message
     * @param  array  $context
     * @return void
     */
    public function __construct($level, $message, array $context = [])
    {
        $this->level = $level;
        $this->message = $message;
        $this->context = $context;
    }
}