summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/core/Log.php23
1 files changed, 20 insertions, 3 deletions
diff --git a/system/core/Log.php b/system/core/Log.php
index 72d3cfbae..7c81d358b 100644
--- a/system/core/Log.php
+++ b/system/core/Log.php
@@ -154,8 +154,8 @@ class CI_Log {
*
* 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 @@ class CI_Log {
$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 @@ class CI_Log {
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";
+ }
}