<commit_before><?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 <NAME> <<EMAIL>>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 *
 * @package    symfony
 * @subpackage log
 * @author     <NAME> <<EMAIL>>
 * @version    SVN: $Id$
 */
class sfFileLogger
{
  protected
    $fp = null;

  public function initialize($options = array())
  {
    if (!isset($options['file']))
    {
      throw new sfConfigurationException('File option is mandatory for a file logger');
    }

    if (!is_dir(dirname($options['file'])))
    {
      mkdir($options['file'], 0777, 1);
    }

    $this->fp = fopen($options['file'], 'a');
  }

  public function log($message, $priority, $priorityName)
  {
    $line = sprintf("%s %s [%s] %s%s", strftime('%b %d %H:%M:%S'), 'symfony', $priorityName, $message, strstr(PHP_OS, 'WIN') ? "\r\n" : "\n");

    flock($this->fp, LOCK_EX);
    fwrite($this->fp, $line);
    flock($this->fp, LOCK_UN);
  }

  public function shutdown()<commit_msg>fixed directory creation in sfFileLogger<commit_after><?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 <NAME> <<EMAIL>>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 *
 * @package    symfony
 * @subpackage log
 * @author     <NAME> <<EMAIL>>
 * @version    SVN: $Id$
 */
class sfFileLogger
{
  protected
    $fp = null;

  public function initialize($options = array())
  {
    if (!isset($options['file']))
    {
      throw new sfConfigurationException('File option is mandatory for a file logger');
    }

    if (!is_dir(dirname($options['file'])))
    {
      mkdir(dirname($options['file']), 0777, 1);
    }

    $this->fp = fopen($options['file'], 'a');
  }

  public function log($message, $priority, $priorityName)
  {
    $line = sprintf("%s %s [%s] %s%s", strftime('%b %d %H:%M:%S'), 'symfony', $priorityName, $message, strstr(PHP_OS, 'WIN') ? "\r\n" : "\n");

    flock($this->fp, LOCK_EX);
    fwrite($this->fp, $line);
    flock($this->fp, LOCK_UN);
  }

  public function shutdown()
{'fraction_non_alphanumeric': 0.1814038286235187, 'fraction_numerical': 0.011850501367365542, 'mean_word_length': 3.363817097415507, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 23, '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': '7472925', 'n_tokens_mistral': 770, 'n_tokens_neox': 731, 'n_words': 203}