public function log($level, $message, array $context = array())
	{
		$group = '';
		
		if (isset($context['group'])) {
			$group = $context['group'];
		}
		
		if ($this->groupfilter == '' || $group == '' && $this->groupfilter != 'all') {
			return false;
		}
		
		$logallowed = false;
		
		if ($this->groupfilter == 'all') {
			$logallowed = true;
		} else {
			foreach (explode('|',$group) as $f) {
				if (preg_match('!\\|'.preg_quote($f).'\\|!','|'.$this->groupfilter.'|')) {
					// do log if any path of the filter is allowed to log
					$logallowed = true;
					break;
				}
			}
		}
		
		if (!$logallowed) {
			return false;
		}
		
		if (!$this->extraFilter($level,$context)) {
			return false;
		}
		
		// add log entry to the file
		
		if (is_array($message) || is_object($message)) {
			$message = print_r($message,true);
		}

		$logfilehandle = @fopen($this->logfile,'a');
		
		if (!$logfilehandle) {
			return false;
		}
		
		fwrite($logfilehandle, $this->formatLogLine($message) . "\n");
		
		if (isset($context['extrainfo'])) {
			// log this too
			fwrite($logfilehandle, "\t" . $context['extrainfo'] . "\n");
		}
		
		if ($level == LogLevel::ERROR || 
			$level == LogLevel::CRITICAL ||
			$level == LogLevel::EMERGENCY) {
			
			// maybe logging of trace is needed
			if (isset($context['exception']) && $context['exception'] instanceof \Exception) {
				if ($this->forcelogtrace || $context['forcelogtrace'] === true) {
					fwrite($logfilehandle, $context['exception']->getTraceAsString() . "\n");
				}
			}
		}

		fclose($logfilehandle);
		
		return true;
	}