mako\Log


Description


Logginger class.


Class methods


Toggle source

protected __construct()


Protected constructor since this is a static class.

Return value

NULL

protected function __construct()
{
	// Nothing here
}

Toggle source

public static instance($name = NULL)


Returns an instance of the requested log configuration.


Parameters

Type Description
string (optional) Log configuration name
Return value

mako\log\Adapter

public static function instance($name = null)
{
	$config = Config::get('log');
		
	$name = ($name === null) ? $config['default'] : $name;
	
	if(!isset(static::$instances[$name]))
	{	
		if(isset($config['configurations'][$name]) === false)
		{
			throw new RuntimeException(vsprintf("%s(): '%s' has not been defined in the log configuration.", array(__METHOD__, $name)));
		}
		
		$class = '\mako\log\\' . $config['configurations'][$name]['type'];
		
		static::$instances[$name] = new $class($config['configurations'][$name]);
	}

	return static::$instances[$name];
}

Toggle source

public static __callStatic($name, $arguments)


Magic shortcut for writing to logs.


Parameters

Type Description
string Name of the log type
string Method arguments
Return value

boolean

public static function __callStatic($name, $arguments)
{
	if(!defined('static::' . strtoupper($name)))
	{
		throw new RuntimeException(vsprintf("%s(): Invalid log type.", array(__METHOD__)));
	}

	return static::instance()->write($arguments[0], constant('static::' . strtoupper($name)));
}