Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created February 16, 2019 00:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/4414e136aedee8c24fded5907fad47c0 to your computer and use it in GitHub Desktop.
Save parzibyte/4414e136aedee8c24fded5907fad47c0 to your computer and use it in GitHub Desktop.
<?php
# Estamos dentro del controlador, si no logueas en el controlador no indiques el namespace
namespace App\Http\Controllers;
# Usar el namespace de Log
use Illuminate\Support\Facades\Log;
class AlgunControlador extends Controller
{
public function algunaFuncion()
{
# Listo, aquí llama a Log::algunMetodo();
Log::debug("Hola mundo, soy un mensaje de debug desde parzibyte.me");
# También puedes pasar datos en forma de arreglo:
$nombre = "Luis";
Log::debug("Se está registrando un usuario", ["nombre" => $nombre]);
# O usar var_export concatenando, aunque no lo recomiendo. Lee sobre var_export:
# https://parzibyte.me/blog/2018/05/18/alternativa-var_dump-php-detalles-variable/
$mascota = [
"nombre" => "Maggie"
];
Log::info("Tenemos una mascota: " . var_export($mascota, true));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment