Dynamic logging channels for Laravel - Canales de registros (logs) dinámicos para Laravel

v1.0.1 2025-09-15 22:10 UTC

This package is auto-updated.

Last update: 2025-09-16 16:42:39 UTC


README

ByteNexSolutions
Packagist License: MIT Author

ByteNexSolutions DynaLog (bytenexsolutions-dynalog)

Table of Contents / Tabla de contenidos
  1. About the package / Acerca del paquete
  2. Getting Started / Primeros pasos
  3. Usage / Uso
  4. Contributing / Contribuyendo
  5. License / Licencia
  6. Contact / Contacto
  7. Acknowledgments / Agradecimientos

About the package / Acerca del paquete

Dynalog is a solutions to make Laravel logs channels dynamicaly, without declare on logging config file.

Dynalog es una solución para crear canales de logs en Laravel de forma dinámica, sin declaraciones en el archivo de configuracíon del logging.

(back to top)

Built to / Construido para

  • Laravel

(back to top)

Getting Started / Primeros pasos

You do not need to publish any configuration files. DynaLog creates dynamic log channels organized by category and source (category / source).

No es necesario publicar ningún archivo de configuración. DynaLog crea canales de registros (logs) dinámicos organizados por categoría y fuente (category / source).

Automatically generated structure / Estructura generada automáticamente:

storage/logs/{category}/{source}/YYYY-MM-DD.log

Example / Ejemplo

storage/logs/Payments/Stripe/2025-09-08.log

Example of logs structure / Ejemplo de estructura de registros (logs)

storage/logs/
 └── Payments/
     └── Stripe/
         ├── 2025-09-07.log
         └── 2025-09-08.log
 └── Users/
     └── Auth/
         └── 2025-09-08.log
 └── Notifications/
     └── Twilio/
         └── 2025-09-08.log

Prerequisites / Pre requisitos

Require / Requiere PHP >= 8.0.2 y Laravel 9+.

Instalation / Instalación

composer require bytenexsolutions/dynalog

(back to top)

Usage / Uso

You can use the DynaLog facade to create a dynamic logger and log messages.

Puedes usar el facade DynaLog para crear un logger dinámico y registrar mensajes.

Example / Ejemplo

// Import DynaLog / Importar Dynalog
use ByteNexSolutions\DynaLog\Facades\DynaLog;

// Create a logger for the "Payments" category and "Stripe" source / Crear un logger para la categoría "Payments" y fuente "Stripe"
$logger = DynaLog::make('Payments', 'Stripe');
or without Import / o sin importarlo
$logger = \DynaLog::make('Payments', 'Stripe');
// Record different log levels / Registrar diferentes niveles de log
$logger->info('Payment process started', ['user_id' => 123]);
$logger->debug('Payload received', ['payload' => $payload]);
$logger->warning('Payment delayed response');
$logger->error('Payment failed', ['error_code' => 'TIMEOUT']);
$logger->critical('Stripe API unreachable');

You can also call static methods of the facade directly.

También puedes llamar directamente a los métodos estáticos de la facade.

Example / Ejemplo

DynaLog::make('Users', 'Auth')->info('User login success', ['id' => 321]);

By default DynaLog use "storage_path('logs')" and default days as 7. If you want to change please publish dynalog config file.

Por defecto, DynaLog utiliza «storage_path(“logs”)» y el número de días predeterminado es 7. Si desea cambiarlo, publique el archivo de configuración de DynaLog.

Publish / Publicar

php artisan vendor:publish --tag=dynalog-config

(back to top)

Acknowledgments / Agradecimientos

(back to top)