From 84036ae54df4dbbc6e652ca9ee5d205fb20703a5 Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 15 Jun 2004 10:22:36 +0000 Subject: [PATCH] Added the ability to specify logging filename prefix. --- lib/Log.inc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Log.inc b/lib/Log.inc index 9fa8bbf..a6177b8 100644 --- a/lib/Log.inc +++ b/lib/Log.inc @@ -51,24 +51,25 @@ class Log { * * @param string the path to the logfile to write to * @param int the desired level to log at + * @param string log file name prefix */ - function Log($logDirectory, $logLevel = INFO) { + function Log($logDirectory, $logLevel = INFO, $sLogFilePrefix = "log") { $this->logDirectory = $logDirectory; $this->minimumLoggingLevel = $logLevel; - $this->initialiseLogFile(); + $this->initialiseLogFile($sLogFilePrefix); } /** * Creates the log file from the current datetime */ - function initialiseLogFile() { + function initialiseLogFile($sLogFilePrefix) { global $default; if (!file_exists($this->logDirectory)) { mkdir($this->logDirectory, 0755); } - $this->logFile = $this->logDirectory . "/log-" . date("d-m-Y") . ".txt"; + $this->logFile = $this->logDirectory . "/$sLogFilePrefix-" . date("d-m-Y") . ".txt"; if (!file_exists($this->logFile)) { touch($this->logFile); } -- libgit2 0.21.4