Merge pull request #4323 from jspreddy/sai/log_line_formatting_extensibility_change

Refactored CI_Log line formatting to allow extensibility
diff --git a/system/core/Log.php b/system/core/Log.php
index 72d3cfb..7c81d35 100644
--- a/system/core/Log.php
+++ b/system/core/Log.php
@@ -154,8 +154,8 @@
 	 *
 	 * Generally this function will be called using the global log_message() function
 	 *
-	 * @param	string	the error level: 'error', 'debug' or 'info'
-	 * @param	string	the error message
+	 * @param	string	$level 	The error level: 'error', 'debug' or 'info'
+	 * @param	string	$msg 	The error message
 	 * @return	bool
 	 */
 	public function write_log($level, $msg)
@@ -204,7 +204,7 @@
 			$date = date($this->_date_fmt);
 		}
 
-		$message .= $level.' - '.$date.' --> '.$msg."\n";
+		$message .= $this->_format_line($level, $date, $msg);
 
 		flock($fp, LOCK_EX);
 
@@ -227,4 +227,21 @@
 		return is_int($result);
 	}
 
+	// --------------------------------------------------------------------
+
+	/**
+	 * Format the log line.
+	 *
+	 * This is for extensibility of log formatting
+	 * If you want to change the log format, extend the CI_Log class and override this method
+	 *
+	 * @param	string	$level 	The error level
+	 * @param	string	$date 	Formatted date string
+	 * @param	string	$msg 	The log message
+	 * @return	string	Formatted log line with a new line character '\n' at the end
+	 */
+	protected function _format_line($level, $date, $message)
+	{
+		return $level.' - '.$date.' --> '.$message."\n";
+	}
 }