Commit 84036ae54df4dbbc6e652ca9ee5d205fb20703a5
1 parent
dac65490
Added the ability to specify logging filename prefix.
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2864 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
5 additions
and
4 deletions
lib/Log.inc
| @@ -51,24 +51,25 @@ class Log { | @@ -51,24 +51,25 @@ class Log { | ||
| 51 | * | 51 | * |
| 52 | * @param string the path to the logfile to write to | 52 | * @param string the path to the logfile to write to |
| 53 | * @param int the desired level to log at | 53 | * @param int the desired level to log at |
| 54 | + * @param string log file name prefix | ||
| 54 | */ | 55 | */ |
| 55 | - function Log($logDirectory, $logLevel = INFO) { | 56 | + function Log($logDirectory, $logLevel = INFO, $sLogFilePrefix = "log") { |
| 56 | $this->logDirectory = $logDirectory; | 57 | $this->logDirectory = $logDirectory; |
| 57 | $this->minimumLoggingLevel = $logLevel; | 58 | $this->minimumLoggingLevel = $logLevel; |
| 58 | - $this->initialiseLogFile(); | 59 | + $this->initialiseLogFile($sLogFilePrefix); |
| 59 | } | 60 | } |
| 60 | 61 | ||
| 61 | 62 | ||
| 62 | /** | 63 | /** |
| 63 | * Creates the log file from the current datetime | 64 | * Creates the log file from the current datetime |
| 64 | */ | 65 | */ |
| 65 | - function initialiseLogFile() { | 66 | + function initialiseLogFile($sLogFilePrefix) { |
| 66 | global $default; | 67 | global $default; |
| 67 | if (!file_exists($this->logDirectory)) { | 68 | if (!file_exists($this->logDirectory)) { |
| 68 | mkdir($this->logDirectory, 0755); | 69 | mkdir($this->logDirectory, 0755); |
| 69 | } | 70 | } |
| 70 | 71 | ||
| 71 | - $this->logFile = $this->logDirectory . "/log-" . date("d-m-Y") . ".txt"; | 72 | + $this->logFile = $this->logDirectory . "/$sLogFilePrefix-" . date("d-m-Y") . ".txt"; |
| 72 | if (!file_exists($this->logFile)) { | 73 | if (!file_exists($this->logFile)) { |
| 73 | touch($this->logFile); | 74 | touch($this->logFile); |
| 74 | } | 75 | } |