]> git.donarmstrong.com Git - infobot.git/commitdiff
use getPath() for create logdir for openLog()
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Sat, 12 Aug 2000 12:41:26 +0000 (12:41 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Sat, 12 Aug 2000 12:41:26 +0000 (12:41 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@38 c11ca15a-4712-0410-83d8-924469b57eb5

src/logger.pl

index 6d0ec1cce038363f4239d064ae65e7aa673e219f..b8eb4b9aa0c07be6ceb9f02f5da01807f299c8e5 100644 (file)
@@ -73,6 +73,20 @@ sub openLog {
     return unless (&IsParam("logfile"));
     $file{log} = $param{'logfile'};
 
+    my $error = 0;
+    my $path = &getPath($file{log});
+    while (! -d $path) {
+       if ($error) {
+           &ERROR("openLog: failed opening log to $file{log}; disabling.");
+           delete $param{'logfile'};
+           return;
+       }
+
+       &status("openLog: making $path.");
+       last if (mkdir $path, 0755);
+       $error++;
+    }
+
     if (&IsParam("logType") and $param{'logType'} =~ /DAILY/i) {
        my ($day,$month,$year) = (localtime(time()))[3,4,5];
        $logDate = sprintf("%04d%02d%02d",$year+1900,$month+1,$day);