You are here

function monolog_prepare_log_dir in Monolog 6

Same name and namespace in other branches
  1. 7 monolog.module \monolog_prepare_log_dir()

Helper function that prepares a directory for logging.

Parameters

string $directory: The URI to the directory containing the log files.

Throws

\InvalidArgumentException

2 calls to monolog_prepare_log_dir()
monolog_rotating_file_handler_loader in handlers/rotating_file.inc
Monolog loader callback; Loads a RotatingFileHandler handler.
monolog_stream_handler_loader in handlers/stream.inc
Monolog loader callback; Loads a StreamHandler handler.

File

./monolog.module, line 256
A Framework and UI for integrating with the Monolog library.

Code

function monolog_prepare_log_dir($directory) {
  if (!file_prepare_directory($directory, FILE_CREATE_DIRECTORY)) {
    throw new \InvalidArgumentException(t('Error creating directory: @dir', array(
      '@dir' => $directory,
    )));
  }
  if (0 === strpos($directory, 'public://')) {
    file_create_htaccess($directory, TRUE);
  }
}