This package enforces several validation rules to ensure consistent and maintainable logs across your application:
Examples:
// ✅ Valid
Log::info('User registered successfully');
Log::error('Payment processing failed');
// ❌ Invalid
Log::info('user registered successfully'); // Doesn't start with capital
Log::error('The payment processing failed with error code 500 and we need to investigate this issue further'); // Too long
Log::warning('User signed-in from suspicious IP!'); // Contains invalid character (!)
userId
not user_id
)// ✅ Valid
Log::info('User registered', ['userId' => 123, 'emailVerified' => true]);
Log::error('Payment failed', ['orderId' => 'ORD-123', 'errorCodes' => [4001, 4002]]);
// ❌ Invalid
Log::info('User registered', ['user_id' => 123]); // Not camelCase
Log::error('Payment failed', ['order' => new Order()]); // Contains object
Log::warning('Data processed', ['items' => [['id' => 1], ['id' => 2]]]); // Nested array
Logs containing an exception in their context are exempted from validation. This allows for detailed exception logging without validation constraints.
By default, validations only run on non-production environments (local
, testing
, staging
). You can customize this in the lalo.php
config file.