master

laravel/framework

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

Log.php

TLDR

This file contains the definition of the Log class, which is a facade for the Laravel logging system. It provides static methods for interacting with the logging system and retrieving loggers.

Methods

build

Builds a logger instance with the given configuration.

stack

Creates a new logger with multiple channels.

channel

Gets the default logger or creates a new logger instance with the given channel.

driver

Gets the default logger or creates a new logger instance with the given driver.

shareContext

Shares a context array across all loggers.

sharedContext

Gets the shared context array.

flushSharedContext

Flushes the shared context array.

getDefaultDriver

Gets the default driver.

setDefaultDriver

Sets the default driver.

extend

Registers a custom logger creator.

forgetChannel

Removes a channel.

getChannels

Gets an array of registered channels.

emergency

Logs a message at the emergency level.

alert

Logs a message at the alert level.

critical

Logs a message at the critical level.

error

Logs a message at the error level.

warning

Logs a message at the warning level.

notice

Logs a message at the notice level.

info

Logs a message at the info level.

debug

Logs a message at the debug level.

log

Logs a message at the specified level.

write

Writes a message to the log at the specified level.

withContext

Creates a new logger instance with additional context.

withoutContext

Removes the context from the logger instance.

listen

Registers a callback to be called when a log message is written.

getLogger

Gets the logger instance.

getEventDispatcher

Gets the event dispatcher instance.

setEventDispatcher

Sets the event dispatcher instance.

when

Conditionally applies a callback to the logger instance.

unless

Conditionally applies a callback to the logger instance when the condition is false.

Classes

There are no additional classes in this file.

<?php

namespace Illuminate\Support\Facades;

/**
 * @method static \Psr\Log\LoggerInterface build(array $config)
 * @method static \Psr\Log\LoggerInterface stack(array $channels, string|null $channel = null)
 * @method static \Psr\Log\LoggerInterface channel(string|null $channel = null)
 * @method static \Psr\Log\LoggerInterface driver(string|null $driver = null)
 * @method static \Illuminate\Log\LogManager shareContext(array $context)
 * @method static array sharedContext()
 * @method static \Illuminate\Log\LogManager flushSharedContext()
 * @method static string|null getDefaultDriver()
 * @method static void setDefaultDriver(string $name)
 * @method static \Illuminate\Log\LogManager extend(string $driver, \Closure $callback)
 * @method static void forgetChannel(string|null $driver = null)
 * @method static array getChannels()
 * @method static void emergency(string $message, array $context = [])
 * @method static void alert(string $message, array $context = [])
 * @method static void critical(string $message, array $context = [])
 * @method static void error(string $message, array $context = [])
 * @method static void warning(string $message, array $context = [])
 * @method static void notice(string $message, array $context = [])
 * @method static void info(string $message, array $context = [])
 * @method static void debug(string $message, array $context = [])
 * @method static void log(mixed $level, string $message, array $context = [])
 * @method static void write(string $level, \Illuminate\Contracts\Support\Arrayable|\Illuminate\Contracts\Support\Jsonable|\Illuminate\Support\Stringable|array|string $message, array $context = [])
 * @method static \Illuminate\Log\Logger withContext(array $context = [])
 * @method static \Illuminate\Log\Logger withoutContext()
 * @method static void listen(\Closure $callback)
 * @method static \Psr\Log\LoggerInterface getLogger()
 * @method static \Illuminate\Contracts\Events\Dispatcher getEventDispatcher()
 * @method static void setEventDispatcher(\Illuminate\Contracts\Events\Dispatcher $dispatcher)
 * @method static \Illuminate\Log\Logger|mixed when(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
 * @method static \Illuminate\Log\Logger|mixed unless(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
 *
 * @see \Illuminate\Log\LogManager
 */
class Log extends Facade
{
    /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor()
    {
        return 'log';
    }
}