1. <?php
  2. /**
  3. * Generates log configuration settings.
  4. *
  5. * This function creates a configuration array for logging,
  6. * including limits on file size, number of files, and maximum
  7. * log file age. These limits are hardcoded for this utility.
  8. *
  9. * @return array An associative array containing log configuration settings.
  10. */
  11. function generateLogConfig(): array
  12. {
  13. // Define log file path. Change as needed.
  14. $logFilePath = '/var/log/myutility.log';
  15. // Define maximum log file size (in MB).
  16. $maxLogFileSizeMB = 10;
  17. // Define maximum number of log files to keep.
  18. $maxLogFiles = 5;
  19. // Define maximum age of log files (in days).
  20. $maxLogFileAgeDays = 30;
  21. // Create the log configuration array.
  22. $logConfig = [
  23. 'logFilePath' => $logFilePath,
  24. 'maxFileSizeMB' => $maxLogFileSizeMB,
  25. 'maxLogFiles' => $maxLogFiles,
  26. 'maxLogFileAgeDays' => $maxLogFileAgeDays,
  27. ];
  28. return $logConfig;
  29. }
  30. // Example usage:
  31. // $config = generateLogConfig();
  32. // print_r($config);
  33. ?>

Add your comment