Skip to content

Commit

Permalink
Logger now use new Path handling from manialib
Browse files Browse the repository at this point in the history
  • Loading branch information
magnetik committed Feb 12, 2014
1 parent dbc27bc commit d7dc9ba
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions ManiaLive/Utilities/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace ManiaLive\Utilities;

use ManiaLib\Utils\Path;

class Logger
{
private static $logs = array();
Expand Down Expand Up @@ -39,10 +41,11 @@ private function __construct($name)
{
// if path does not exist ...
$config = \ManiaLive\Config\Config::getInstance();
if(!is_dir($config->logsPath))
mkdir($config->logsPath, '0777', true);

$this->path = $config->logsPath.'/'.($config->logsPrefix ? $config->logsPrefix.'-' : '').$name.'.txt';
$path = \ManiaLib\Utils\Path::getInstance();
if(!is_dir($path->getLog(true)))
mkdir($path->getLog(true), '0777', true);

$this->path = $path->getLog(true).'/'.($config->logsPrefix ? $config->logsPrefix.'-' : '').$name.'.txt';
$this->enabled = true;
}

Expand Down Expand Up @@ -111,19 +114,19 @@ static protected function load()
{
$config = \ManiaLive\Config\Config::getInstance();

if(!is_dir($config->logsPath))
if(!is_dir(Path::getInstance()->getLog(true)))
{
if(mkdir($config->logsPath, '0777', true))
if(mkdir(Path::getInstance()->getLog(true), '0777', true))
{
self::$loaded = true;
self::$staticPath = $config->logsPath.'/';
self::$staticPath = Path::getInstance()->getLog(true).DIRECTORY_SEPARATOR;
self::$staticPrefix = $config->logsPrefix ? $config->logsPrefix.'-' : '';
}
}
else
{
self::$loaded = true;
self::$staticPath = $config->logsPath.'/';
self::$staticPath = Path::getInstance()->getLog(true).DIRECTORY_SEPARATOR;
self::$staticPrefix = $config->logsPrefix ? $config->logsPrefix.'-' : '';
}
}
Expand Down

0 comments on commit d7dc9ba

Please sign in to comment.