Enable or disable logging to a hooked class

@since 2.1.0
@access public
@param string $className
@param string $logFunction
@param bool $bool
@return \Icepay_Basicmode
488334
public function logToFunction($className = null, $logFunction = null, $bool = true)
    {
        $this->_logToHook = $bool;

        if (class_exists($className))
            $this->_logHookClass = new $className;

        if (is_callable($logFunction))
            $this->_logHookFunc = $logFunction;

        return $this;
    }
476263
public function enable($enableLogger, $loggerDir)
    {
        $this->setLogConfig($enableLogger, $loggerDir);

        $debuggerMode = null;
        $debuggerMode = Debugger::DEVELOPMENT;

        if ($this->env == 'production') {
            $debuggerMode = Debugger::PRODUCTION;
        }

        return $this->enableDebuggerWith($debuggerMode);
    }
678825
public function showMarker( $bool = true )
	{
	    if ( $this->jsWriter instanceOf \Altamira\JsWriter\Ability\Lineable ) {
	        $this->jsWriter->setSeriesShowMarker( $this->getTitle(), $bool );
	    }
	    return $this;
	}
324832
function setDebug($bool)
    {
        $this->dbug = (boolean) $bool;
        $this->cfs_http->setDebug($this->dbug);
    }
1109685
public function when($value, $true_call, $false_call = null)
    {
        if ($value) {
            $true_call($this, $value);
        } elseif ($false_call) {
            $false_call($this, $value);
        }

        return $this;
    }
68312
public function basic_cancel($consumer_tag, $nowait = false, $noreturn = false)
    {
        list($class_id, $method_id, $args) = $this->protocolWriter->basicCancel($consumer_tag, $nowait);
        $this->send_method_frame(array($class_id, $method_id), $args);

        if ($nowait || $noreturn) {
            unset($this->callbacks[$consumer_tag]);
            return $consumer_tag;
        }

        return $this->wait(array(
            $this->waitHelper->get_wait('basic.cancel_ok')
        ), false, $this->channel_rpc_timeout);
    }
1359521
public static function appendLogEntry( $logString, $label = false )
    {
        if ( !isset( self::$useLogging ) )
        {
            $webdavINI = eZINI::instance( self::WEBDAV_INI_FILE );
            self::$useLogging = $webdavINI->variable( 'GeneralSettings', 'Logging' ) === 'enabled';
        }

        if ( self::$useLogging )
        {
            if ( PHP_SAPI === 'cli' )
            {
                // var_dump( $logString );
            }
            else
            {
                $varDir = realpath( eZSys::varDirectory() );
                $logDir = 'log';
                $logName = 'webdav.log';
                $fileName = $varDir . DIRECTORY_SEPARATOR . $logDir . DIRECTORY_SEPARATOR . $logName;
                if ( !file_exists( $varDir . DIRECTORY_SEPARATOR . $logDir ) )
                {
                    eZDir::mkdir( $varDir . DIRECTORY_SEPARATOR . $logDir, 0775, true );
                }

                $logFile = fopen( $fileName, 'a' );
                $nowTime = date( "Y-m-d H:i:s : " );
                $text = $nowTime . $logString;
                if ( $label )
                {
                    $text .= ' [' . $label . ']';
                }
                fwrite( $logFile, $text . "\n" );
                fclose( $logFile );
            }
        }
    }
729162
public function query_log($error=false) {
        // Logging disabled by the driver.
        if ($this->skiplogging) {
            return;
        }

        $logall    = !empty($this->dboptions['logall']);
        $logslow   = !empty($this->dboptions['logslow']) ? $this->dboptions['logslow'] : false;
        $logerrors = !empty($this->dboptions['logerrors']);
        $iserror   = ($error !== false);

        $time = $this->query_time();

        // Will be shown or not depending on MDL_PERF values rather than in dboptions['log*].
        $this->queriestime = $this->queriestime + $time;

        if ($logall or ($logslow and ($logslow < ($time+0.00001))) or ($iserror and $logerrors)) {
            $this->loggingquery = true;
            try {
                $backtrace = debug_backtrace();
                if ($backtrace) {
                    //remove query_log()
                    array_shift($backtrace);
                }
                if ($backtrace) {
                    //remove query_end()
                    array_shift($backtrace);
                }
                $log = new stdClass();
                $log->qtype      = $this->last_type;
                $log->sqltext    = $this->last_sql;
                $log->sqlparams  = var_export((array)$this->last_params, true);
                $log->error      = (int)$iserror;
                $log->info       = $iserror ? $error : null;
                $log->backtrace  = format_backtrace($backtrace, true);
                $log->exectime   = $time;
                $log->timelogged = time();
                $this->insert_record('log_queries', $log);
            } catch (Exception $ignored) {
            }
            $this->loggingquery = false;
        }
    }
1288659
public function allowLogs($flag = true)
    {
        $this->allowLogs = (bool) $flag;
        
        if (true === $flag) {
            $this->init();
        }
        
        return $this;
    }
57938
public function loadData($printQuery = false, $logQuery = false)
    {
        if ($this->isLoaded()) {
            return $this;
        }

        $this->clear();

        foreach ($this->getResource()->getJobCodes() as $jobCode) {
            if (!empty($this->whiteList) && !in_array($jobCode, $this->whiteList)) {
                continue;
            }
            if (!empty($this->blackList) && in_array($jobCode, $this->blackList)) {
                continue;
            }

            $job = $this->getNewEmptyItem()->load($jobCode);
            if ($this->activeOnly && !$job->getIsActive()) {
                continue;
            }
            if ($this->dbOnly && !$job->isDbOnly()) {
                continue;
            }

            $this->addItem($job);
        }

        ksort($this->_items);

        $this->_setIsLoaded(true);

        return $this;
    }
1230173
public function setVerbose($bool)
    {
        $decorator = $this->getDecorator('TabErrors');
        if ($decorator) {
            $decorator->setOption('verbose', (bool) $bool);
        }
    }
935539
public final TcpClient wiretap(boolean enable) {
		if (enable) {
			return bootstrap(b -> BootstrapHandlers.updateLogSupport(b, LOGGING_HANDLER));
		}
		else {
			return bootstrap(b -> BootstrapHandlers.removeConfiguration(b, NettyPipeline.LoggingHandler));
		}
	}
301282
public static function get_handler($classname) {
        global $DB;

        if (strpos($classname, '\\') !== 0) {
            $classname = '\\' . $classname;
        }

        $record = $DB->get_record('messageinbound_handlers', array('classname' => $classname), '*', IGNORE_MISSING);
        if (!$record) {
            return false;
        }
        return self::handler_from_record($record);
    }
297560
public function enableLogQueries(bool $flag = true)
    {
        $this->settings()->set('log_queries', (int) $flag);

        return $this;
    }
1265315
protected function bool(string $name, $default = null): Closure
    {
        return function (Table $table) use ($name, $default) {
            $column = $table->addColumn($name, Type::BOOLEAN)->setNotnull(true);
            if ($default !== null && is_bool($default) === true) {
                $column->setDefault($default);
            }
        };
    }
810737
public synchronized static Log getLog(Class< ? > clazz)
    {
        if (slf4jLoggingAvailable == null)
        {
            try
            {
                classLoader.loadClass("org.slf4j.Logger");
                slf4jLoggingAvailable = Boolean.TRUE;
            }
            catch (Exception e)
            {
                slf4jLoggingAvailable = Boolean.FALSE;
            }
        }

        if (slf4jLoggingAvailable)
        {
            try
            {
                return new Slf4JLogger(clazz);
            }
            catch (Throwable e)
            {
                slf4jLoggingAvailable = Boolean.FALSE;
            }
        }

        if (log4jLoggingAvailable == null)
        {
            try
            {
                classLoader.loadClass("org.apache.log4j.Logger");
                log4jLoggingAvailable = Boolean.TRUE;
            }
            catch (Exception e)
            {
                log4jLoggingAvailable = Boolean.FALSE;
            }
        }

        if (log4jLoggingAvailable)
        {
            return new Log4JLogger(clazz);
        }

        if (javaLoggingAvailable == null)
        {
            try
            {
                classLoader.loadClass("java.util.logging.Logger");
                javaLoggingAvailable = Boolean.TRUE;
            }
            catch (Exception e)
            {
                javaLoggingAvailable = Boolean.FALSE;
            }
        }
        if (javaLoggingAvailable)
        {
            return new JavaLoggingLog(clazz);
        }
        return new NullLog();
    }
35605
function basic($func=NULL) {
		$fw=Base::instance();
		$realm=$fw->REALM;
		$hdr=NULL;
		if (isset($_SERVER['HTTP_AUTHORIZATION']))
			$hdr=$_SERVER['HTTP_AUTHORIZATION'];
		elseif (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']))
			$hdr=$_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
		if (!empty($hdr))
			list($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW'])=
				explode(':',base64_decode(substr($hdr,6)));
		if (isset($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']) &&
			$this->login(
				$_SERVER['PHP_AUTH_USER'],
				$func?
					$fw->call($func,$_SERVER['PHP_AUTH_PW']):
					$_SERVER['PHP_AUTH_PW'],
				$realm
			))
			return TRUE;
		if (PHP_SAPI!='cli')
			header('WWW-Authenticate: Basic realm="'.$realm.'"');
		$fw->status(401);
		return FALSE;
	}