<commit_before><?php defined('SYSPATH') or die('No direct script access.');
/**
 * File log writer.
 *
 * @package    Kohana
 * @author     Kohana Team
 * @copyright  (c) 2008-2009 Kohana Team
 * @license    http://kohanaphp.com/license.html
 */
class Kohana_Log_File_Core extends Kohana_Log_Writer {

	// Directory to place log files in
	protected $_directory;

	/**
	 * Creates a new file logger.
	 *
	 * @param   string  log directory
	 * @return  void
	 */
	public function __construct($directory)
	{
		if ( ! is_dir($directory) OR ! is_writable($directory))
		{
			throw new Kohana_Exception('Directory :directory must be writable',
				array(':directory' => Kohana::debug_path($directory)));
		}

		// Determine the directory path
		$this->_directory = realpath($directory).'/';
	}

	/**
	 * Writes each of the messages into the log file.
	 *
	 * @param   array   messages
	 * @return  void
	 */
	public function write(array $messages)
	{
		// Set the monthly directory name
		$directory = $this->_directory.date('Y/m').'/';

		if ( ! is_dir($directory))
		{
			// Create the monthly directory
			mkdir($directory, 0777, TRUE);
		}

		// Set the name of the log file
		$filename = $directory.date('d').EXT;

		if ( ! file_exists($filename))
		{
			// Create the log file
			file_put_contents($filename, Kohana::PHP_HEADER.' ?>'.PHP_EOL);

			// Allow anyone to write to log files
			chmod($filename, 0666);
		}

		// Set the log line format
		$format = 'time --- type: body';

		foreach ($messages as $message)
		{
			// Write each message into the log file
			file_put_contents($filename, PHP_EOL.strtr($format, $message), FILE_APPEND);
		}
	}

} // End Kohana_Log_File<commit_msg>Updated Kohana_Log_File, tracking changes in SHA 5470b93661f69cb4846424bff5dead852e7bc29f<commit_after><?php defined('SYSPATH') or die('No direct script access.');
/**
 * File log writer.
 *
 * @package    Kohana
 * @author     Kohana Team
 * @copyright  (c) 2008-2009 Kohana Team
 * @license    http://kohanaphp.com/license.html
 */
class Kohana_Log_File_Core extends Kohana_Log_Writer {

	// Directory to place log files in
	protected $_directory;

	/**
	 * Creates a new file logger.
	 *
	 * @param   string  log directory
	 * @return  void
	 */
	public function __construct($directory)
	{
		if ( ! is_dir($directory) OR ! is_writable($directory))
		{
			throw new Kohana_Exception('Directory :directory must be writable',
				array(':directory' => Kohana::debug_path($directory)));
		}

		// Determine the directory path
		$this->_directory = realpath($directory).'/';
	}

	/**
	 * Writes each of the messages into the log file.
	 *
	 * @param   array   messages
	 * @return  void
	 */
	public function write(array $messages)
	{
		// Set the monthly directory name
		$directory = $this->_directory.date('Y/m').'/';

		if ( ! is_dir($directory))
		{
			// Create the monthly directory
			mkdir($directory, 0777, TRUE);
		}

		// Set the name of the log file
		$filename = $directory.date('d').EXT;

		if ( ! file_exists($filename))
		{
			// Create the log file
			file_put_contents($filename, Kohana::FILE_SECURITY.' ?>'.PHP_EOL);

			// Allow anyone to write to log files
			chmod($filename, 0666);
		}

		// Set the log line format
		$format = 'time --- type: body';

		foreach ($messages as $message)
		{
			// Write each message into the log file
			file_put_contents($filename, PHP_EOL.strtr($format, $message), FILE_APPEND);
		}
	}

} // End Kohana_Log_File
{'fraction_non_alphanumeric': 0.1357452966714906, 'fraction_numerical': 0.01649782923299566, 'mean_word_length': 3.271940667490729, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2345305', 'n_tokens_mistral': 1282, 'n_tokens_neox': 1097, 'n_words': 313}