Output a log entry
@param string $status Log status e.g. error, success, debug
@param string $msg Message to output
@param boolean $nl Add newline to the output
@param boolean $email Email to admin, default false
@return boolean
507590
public static function Output ($status, $msg, $nl = TRUE, $email = FALSE)
	{
		
		$status	= strtoupper ($status);
		
		if (is_array ($msg) || is_object ($msg))
		{
			$msg	= Parser::pre ($msg, 0, TRUE, FALSE);
		}
		
		echo '[' . date ('Y-m-d H:i:s') . '][' . $status . '] ' . $msg . ($nl? "\n" : NULL);
		
		if ($email)
		{
			return static::emailAdmin ($status, $msg);
		}
		
		return TRUE;
		
	}
243626
public static function log($level, $message)
    {
        if ($level <= self::$logLevel) {
            $level = ($level === 3) ? "debug" : (($level === 2) ? "info" : "warn");
            error_log(sprintf('[%s] tideways - %s', $level, $message), 0);
        }
    }
76333
public static function log($msg)
    {
        $msg = $msg . "\n";
        if (!static::$daemonize) {
            static::safeEcho($msg);
        }
        file_put_contents((string)static::$logFile, date('Y-m-d H:i:s') . ' ' . 'pid:'
            . (static::$_OS === OS_TYPE_LINUX ? posix_getpid() : 1) . ' ' . $msg, FILE_APPEND | LOCK_EX);
    }
123069
function _logError($response, $status = -1)
    {
        if ($status == -1) {
            if (strlen($response) < 4) {
                return;
            }
            extract(unpack('Nstatus', $this->_string_shift($response, 4)));
        }

        $error = $this->status_codes[$status];

        if ($this->version > 2 || strlen($response) < 4) {
            extract(unpack('Nlength', $this->_string_shift($response, 4)));
            $this->sftp_errors[] = $error . ': ' . $this->_string_shift($response, $length);
        } else {
            $this->sftp_errors[] = $error;
        }
    }
1272405
protected function writeOutputLine($msg, $min=0, $max=null)
    {
        if (!$this->shouldWriteOutput($min, $max)) {
            return;
        }

        $this->getOutput()->writeln($msg);
    }
778983
public function consoleLog($msg, $level = 1)
    {
        $msg = str_replace("\r", '', $msg);
        $msg = explode("\n", $msg);
        foreach ($msg as $line) {
            if (strlen($line) < 1) {
                continue;
            }
            $this->send(
                'VERBOSE "' . str_replace('"', '\\"', $line) . '" ' . $level
            );
        }
    }
171433
public function log($producer, $msg, $object = false) {
        if(!($this->acceptedProducers & $producer)) { return; }

        $msgFmt = self::format($msg, $this->processId, $this->time, $this->flags);
        if($object) {
            $msgFmt .= " " . json_encode($object);
        }
        $this->logRaw($msgFmt);
    }
190777
public function log($line, $severity, $args = self::NO_ARGUMENTS)
	{
        if ($this->_severityThreshold >= $severity) {
            $status = $this->_getTimeLine($severity);
            
            $line = "$status $line";
            
            if ($args !== self::NO_ARGUMENTS) {
                /* Print the passed object value */
                $line = $line . '; ' . var_export($args, true);
            }
            
            $this->writeFreeFormLine($line . PHP_EOL);
			
			if ($this->_mailingSeverity >= $severity) {
				$this->mailLogging($line,$severity);
			}
        }
    }
1262776
protected function printBoolean(OutputInterface $output, $success, $fail, $value, $line = true)
    {
        if ($value) {
            $message = '<info>' . $success . '</info>';
        } else {
            $message = '<error>' . $fail . '</error>';
        }

        if (false === $line) {
            return $message;
        }

        $output->writeln($message);
    }
182818
public function write_log($level = 'error', $msg = '', $php_error = false)
    {
        /**
         * Ensure this is set correctly. Would use the constructor, however that is
         * called before the pre_system hook (as the constructor of the hook class
         * calls log_message() which in turn constructs this class. The docs LIE when
         * they say only benchmark and hooks class are loaded)
         */

        if (defined('DEPLOY_LOG_DIR')) {

            $this->_log_path = DEPLOY_LOG_DIR;

            //  If we haven't already, check to see if DEPLOY_LOG_DIR is writable
            if (is_null($this->_enabled)) {

                if (is_writable($this->_log_path)) {

                    //  Writable!
                    $this->_enabled = true;

                } else {

                    //  Not writable, disable logging and kick up a fuss
                    $this->_enabled = false;

                    //  Send developer mail, but only once
                    if (!defined('NAILS_LOG_ERROR_REPORTED')) {

                        if (isset($_SERVER['REQUEST_URI'])) {

                            $uri = $_SERVER['REQUEST_URI'];

                        } else {

                            //  Most likely on the CLI
                            if (isset($_SERVER['argv'])) {

                                $uri = 'CLI: ' . implode(' ', $_SERVER['argv']);

                            } else {

                                $uri = 'Unable to determine URI';
                            }
                        }

                        $msg     = strtoupper($level) . ' ' . ((strtoupper($level) == 'INFO') ? ' -' : '-') . ' ' . date($this->_date_fmt) . ' --> ' . $msg . "\n";
                        $appname = defined('APP_NAME') ? APP_NAME : '[Could not determine app name]';

                        $subject = 'Log folders are not writable on ' . $appname;
                        $message = 'I just tried to write to the log folder for ' . $appname . ' and found them not to be writable.' . "\n";
                        $message .= '' . "\n";
                        $message .= 'Get this fixed ASAP - I\'ll bug you every time this happens.' . "\n";
                        $message .= '' . "\n";
                        $message .= 'FYI, the entry was:' . "\n";
                        $message .= '' . "\n";
                        $message .= $msg . "\n";
                        $message .= '' . "\n";
                        $message .= 'The calling URI was:' . "\n";
                        $message .= '' . "\n";
                        $message .= $uri . "\n";
                        $message .= '' . "\n";
                        $message .= 'The path was:' . "\n";
                        $message .= '' . "\n";
                        $message .= $this->_log_path . "\n";
                        $message .= '' . "\n";
                        $message .= 'PHP SAPI Name:' . "\n";
                        $message .= '' . "\n";
                        $message .= php_sapi_name() . "\n";
                        $message .= '' . "\n";
                        $message .= 'PHP Debug Backtrace:' . "\n";
                        $message .= '' . "\n";
                        $message .= json_encode(debug_backtrace()) . "\n";

                        //  Set from details
                        try {

                            $oEmailer = Factory::service('Emailer');

                            $fromName  = $oEmailer->getFromName();
                            $fromEmail = $oEmailer->getFromEmail();

                        } catch (\Exception $e) {

                            $fromName  = 'Log Error Reporter';
                            $fromEmail = 'root@' . gethostname();
                        }

                        $to      = Environment::not(Environment::ENV_PROD) && defined('EMAIL_OVERRIDE') && EMAIL_OVERRIDE ? EMAIL_OVERRIDE : APP_DEVELOPER_EMAIL;
                        $headers = 'From: ' . $fromName . ' <' . $fromEmail . '>' . "\r\n" .
                            'X-Mailer: PHP/' . phpversion() . "\r\n" .
                            'X-Priority: 1 (Highest)' . "\r\n" .
                            'X-Mailer: X-MSMail-Priority: High/' . "\r\n" .
                            'Importance: High';

                        if (!empty($to)) {

                            @mail($to, '!!' . $subject, $message, $headers);
                        }

                        define('NAILS_LOG_ERROR_REPORTED', true);
                    }
                }
            }

        } else {

            //  Don't bother writing as we don't know where to write.
            return false;
        }

        // --------------------------------------------------------------------------

        //  Test Log folder, but only if the error level is to be captured
        $level = strtoupper($level);

        if (!isset($this->_levels[$level]) || ($this->_levels[$level] > $this->_threshold)) {

            return false;
        }

        return parent::write_log($level, $msg, $php_error);
    }
898435
public function addLostPassRequest($login, $email)
    {
        $table = $this->getServiceLocator()->get('MelisLostPasswordTable');
        $data = $this->getPassRequestDataByLogin($email);
        $success = false;
        if(!$this->isDataExists($login)) {
            $table->save(array(
                'rh_id' => null,
                'rh_login' => $login,
                'rh_email' => $email,
                'rh_hash' => $this->generateHash(),
                'rh_date' => date('Y-m-d H:i:s')
            ));
            // first email
            $success = $this->sendPasswordLostEmail($login, $email);
            
        }
        else {
            // resend email
            $table->update(array(
                'rh_date' => date('Y-m-d H:i:s')
            ), 'rh_login', $login);
            $success = $this->sendPasswordLostEmail($login, $email);
        }
        
        return $success;
    }
595145
private function _log($resources, $msg = 'Disabled following resources:')
    {
        if ($this->enableLog) {
            $this->writeLog($msg . "\n" . var_export($resources, true));
        }
    }
351712
public function out($text = '', $nl = true)
	{
		fwrite(STDOUT, $this->processor->process($text) . ($nl ? "\n" : null));

		return $this;
	}
982129
public static function writeRaw($message, bool $nl = true, $quit = false, array $opts = []): int
    {
        $opts['color'] = false;
        return Console::write($message, $nl, $quit, $opts);
    }
465265
protected function log($message, $level = LOG_INFO, $extra_newline = false)
	{
		if (is_array($message)) {
			if (count($message) == 0) {
				return;
			}

			$message = implode(PHP_EOL, $message);
		}

		if ($level == LOG_INFO || ($this->debug && $level == LOG_DEBUG)) {
			echo $message . PHP_EOL;

			if ($extra_newline) {
				echo PHP_EOL;
			}
		}

		if ($this->logfile) {
			error_log($message . PHP_EOL, 3, $this->logfile);
		}
	}
52040
public function info($msg) {
		$this->mailMessage(self::LEVEL_INFO, $msg);

		if($this->checkLevel($this->loglevels, self::LEVEL_INFO) !== true)
			return;

		$this->writeMessage(self::LEVEL_INFO, $msg);
	}
154556
protected function logInfo(string $msg)
    {
        $this->logger->info('CMD: ' . $msg);
        $this->out->writeln("<info>$msg<info>");
    }