<commit_before><?php namespace Laravel;

class Log {

	/**
	 * Log an exception to the log file.
	 *
	 * @param  Exception  $e
	 * @return void
	 */
	public static function exception($e)
	{
		static::write('error', static::exception_line($e));
	}

	/**
	 * Format a log friendly message from the given exception.
	 *
	 * @param  Exception  $e
	 * @return string
	 */
	protected static function exception_line($e)
	{
		return $e->getMessage().' in '.$e->getFile().' on line '.$e->getLine();
	}

	/**
	 * Write a message to the log file.
	 *
	 * <code>
	 *		// Write an "error" message to the log file
	 *		Log::write('error', 'Something went horribly wrong!');
	 *
	 *		// Write an "error" message using the class' magic method
	 *		Log::error('Something went horribly wrong!');
	 *
	 *		// Log an arrays data
	 *		Log::write('info', array('name' => 'Sawny', 'passwd' => '<PASSWORD>', array(1337, 21, 0)), true);
	 *      //Result: Array ( [name] => Sawny [passwd] => <PASSWORD> [0] => Array ( [0] => 1337 [1] => 21 [2] => 0 ) )
	 *      //If we had omit the third parameter the result had been: Array
	 * </code>
	 *
	 * @param  string  $type
	 * @param  string  $message
	 * @return void
	 */
	public static function write($type, $message, $pretty_print = false)
	{
		$message = ($pretty_print) ? print_r($message, true) : $message;

		// If there is a listener for the log event, we'll delegate the logging
		// to the event and not write to the log files. This allows for quick
		// swapping of log implementations for debugging.
		if (Event::listeners('laravel.log'))
		{
			Event::fire('laravel.log', array($type, $message));
		}

		$trace=debug_backtrace();

		foreach($trace as $item)
		{
			if ($item['class'] == __CLASS__)
			{
				continue;
			}

			$caller = $item;

			break;
		}

		$function = $caller['function'];
		if (isset($caller['class']))
		{
			$class = $caller['class'] . '::';
		}<commit_msg>Fixed bug where laravel is generating error log from outside of application classes.<commit_after><?php namespace Laravel;

class Log {

	/**
	 * Log an exception to the log file.
	 *
	 * @param  Exception  $e
	 * @return void
	 */
	public static function exception($e)
	{
		static::write('error', static::exception_line($e));
	}

	/**
	 * Format a log friendly message from the given exception.
	 *
	 * @param  Exception  $e
	 * @return string
	 */
	protected static function exception_line($e)
	{
		return $e->getMessage().' in '.$e->getFile().' on line '.$e->getLine();
	}

	/**
	 * Write a message to the log file.
	 *
	 * <code>
	 *		// Write an "error" message to the log file
	 *		Log::write('error', 'Something went horribly wrong!');
	 *
	 *		// Write an "error" message using the class' magic method
	 *		Log::error('Something went horribly wrong!');
	 *
	 *		// Log an arrays data
	 *		Log::write('info', array('name' => 'Sawny', 'passwd' => '<PASSWORD>', array(1337, 21, 0)), true);
	 *      //Result: Array ( [name] => Sawny [passwd] => 1234 [0] => Array ( [0] => 1337 [1] => 21 [2] => 0 ) )
	 *      //If we had omit the third parameter the result had been: Array
	 * </code>
	 *
	 * @param  string  $type
	 * @param  string  $message
	 * @return void
	 */
	public static function write($type, $message, $pretty_print = false)
	{
		$message = ($pretty_print) ? print_r($message, true) : $message;

		// If there is a listener for the log event, we'll delegate the logging
		// to the event and not write to the log files. This allows for quick
		// swapping of log implementations for debugging.
		if (Event::listeners('laravel.log'))
		{
			Event::fire('laravel.log', array($type, $message));
		}

		$trace=debug_backtrace();

		foreach($trace as $item)
		{
			if (isset($item['class']) AND $item['class'] == __CLASS__)
			{
				continue;
			}

			$caller = $item;

			break;
		}

		$function = $caller['function'];
		if (isset($caller['class']))
		{
			$class = $caller['class'] . '::';
		}
{'fraction_non_alphanumeric': 0.16883448099974496, 'fraction_numerical': 0.0102014792144861, 'mean_word_length': 3.102510460251046, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 32, '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': '1625740', 'n_tokens_mistral': 1452, 'n_tokens_neox': 1274, 'n_words': 408}